Using DirectoryInfo in C#
- by pm_2
If there a more efficient way to do the following:
DirectoryInfo di = new DirectoryInfo(@"c:\");
newFileName = Path.Combine(di.FullName, "MyFile.Txt");
I realise that it’s only two lines of code, but given that I already have the directory, it feels like I should be able to do something like:
newFileName = di.Combine(“MyFile.txt”);