Create Relative Path Using System.Uri
<p>I am converting absolute file-system path to relative path using following code.</p>

<pre><code>public static void Main(string[] args)
{
    System.Uri uri1 = new Uri(@"C:\Users\301591\Downloads\My Pics\abcd.jpg", true);
    System.Uri uri2 = new Uri(@"C:\Users\301591\", true);
    Uri relativeUri = uri2.MakeRelativeUri(uri1);
    Console.WriteLine(relativeUri.ToString());
}
</code></pre>

<p>The result I am getting is /Downloads/My Pics/abcd.jpg</p>

<p>but compiler is throwing a warning, constructor I am using is marked obsolete.</p>

<pre><code>Uri testUri=new Uri("string path","flag to remove escape sequences");
</code></pre>

<p>Is there any other way to create relative path with showing escape sequence in the result?</p>

<p>Regards,
Priyank </p>
