Resolve Path in CSharp
Description
The following code shows how to resolve Path.
Example
// w w w . j ava2s . com
using System;
using System.Text;
using System.IO;
using System.Web;
public class FileUtils
{
public static void Main(String[] argv)
{
string basePath = "c:/abc/def/x";
string relativePath = "../test";
string resolvedPath = Path.Combine(basePath, relativePath);
resolvedPath = Path.GetFullPath(resolvedPath);
Console.WriteLine(resolvedPath);
}
}
The code above generates the following result.