Why does OpenFileDialog change my working directory? Should i assume many func in System.Windows.Forms will change my working directory?
OpenFileDialog open = new OpenFileDialog();
open.Filter = filter;
a = Directory.GetCurrentDirectory(); //<-- correct
if (open.ShowDialog() == DialogResult.OK) //-- select a file on my desktop
{
a = Directory.GetCurrentDirectory(); //<-- incorrect, is set to my desktop
Or you can make it not do that. See the FileDialog.RestoreDirectory property.