Environment.CurrentDirectory effects after using FileDialog Boxes

When ever you are using Environment.CurrentDirectory you must be cautious  because it has an advantage of changing the CurrentDirectory path at anytime in your code it has major disadvantage of changing its path when ever your are using the controls like FileDialogs.

So how can i replace the Environment.CurrentDirectory place? With Whom i can replace the Environment.CurrentDirectory place?

Here we have the solution with AppDomain.CurrentDomain.BaseDirectory. AppDomain.CurrentDomain.BaseDirectory is read-only since you can’t change it after the appdomain has been created.

Advertisements

2 thoughts on “Environment.CurrentDirectory effects after using FileDialog Boxes

  1. Well, when i first encountered with the problem, i solved it with the FileDialog.Restore property, since i have to work on a certain directory using FileDialog to copy file to current directory only. it’s alternative

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s