Hi everyone,
var fileOpen = new OpenFileDialog();
var clickedOk = fileOpen.ShowDialog();
if (!((bool) clickedOk)) return;
var path = fileOpen.FileName;
var diPath = new DirectoryInfo(path);
var fiPath = new FileInfo(path);
Debug.WriteLine(diPath.Exists);
I am just wondering why diPath.Exists is false in this case? Since the user has selected a file, the directory must exist!? and it does...
I have used a work around by using Directory.Exists(fiPath.DirectoryName)
but it seems strange that the above isn't working, and slightly irritating to need that other var just to check something that I know is there exists, and should just be able to use the diPath. What's the deal?
Also on a related matter, say I have a directoryinfo for a directory C:\random\spot\here why is there no method to obtain that string "C:\random\spot\here" it seems I can only get Parent "spot" or Name "here". Maybe I missed something.
Thanks,