为什么OpenFileDialog会改变我的工作目录?我应该假设System.Windows.Forms中的许多func会改变我的工作目录吗?
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
Run Code Online (Sandbox Code Playgroud) After using the OpenFileDialog for selecting a file the Environment.CurrentDirectory changes to the folder of the file. Is this normal?
From my understanding Environment.CurrentDirectory should always be the application folder.