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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…