chh
chh

Reputation:

How to pick a file from default location and not by hard coding?

I want to pick my XHTML dtd file from a default location like the bin folder ( where exe file of project resides) and not by hard coding it by giving the exact path of the file like C:\temp\xhtml1.dtd. My code is in C#. Can anyone help how to do it?

Upvotes: 0

Views: 982

Answers (2)

Marc Gravell
Marc Gravell

Reputation: 1063453

One option is to use the application-base:

string path = Path.Combine(
            AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
            "foo.dtd");

Upvotes: 3

Unknown
Unknown

Reputation: 46811

I think this might be what you want?

string xhtml = Directory.GetCurrentDirectory()+"xhtml1.dtd";

Upvotes: 0

Related Questions