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.





















Home »
  C# Tutorial »
    IO »




File Attribute
File Security
Directory Attribute
Directory Recursive
Binary File
Text Field
Buffered IO
Create Copy Delete Move
CSV
Drive
File System Watcher
Isolated Storage
MemoryStream
Serialize
Zip