Using DirectoryInfo in C#

Posted by pm_2 on Stack Overflow See other posts from Stack Overflow or by pm_2
Published on 2010-06-11T14:18:58Z Indexed on 2010/06/11 14:22 UTC
Read the original article Hit count: 225

Filed under:
|
|

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”);

© Stack Overflow or respective owner

Related posts about c#

Related posts about textfiles