Saturday, July 20, 2013

C# - Constructing File Paths

When you want to construct file paths, use the following


String filename = "cmd.exe";
String fullpath = System.IO.Path.Combine (Environment.SystemDirectory, filename);
Console.WriteLine(fullpath);

Output:
C:\Windows\System32\cmd.exe

No comments:

Post a Comment