System.Uri class for getting the relative path


Suppose if we need to find a relative path based on a base path, we can use uri class in system.uri  namespace as shown below. 

           
Uri
baseUri = new Uri(basePath);
            Uri fullUri = new Uri(fullPath);
            Uri relativeUri = baseUri.MakeRelativeUri(fullUri);
For example if you are working in a folder called C:\Windows\templates\ and I want to find a relative path for C:\Windows\templates\subdir\test.txt
I want to receive back subdir\test.txt. - In other words always return a non-hardcoded path based on some other known directory.