Method MakeRelativePath
MakeRelativePath(string, string)
Creates a relative path from one file or folder to another.
public static string MakeRelativePath(string fromPath, string toPath)
Parameters
fromPathstringContains the directory that defines the start of the relative path.
toPathstringContains the path that defines the endpoint of the relative path.
Returns
- string
The relative path from the start directory to the end path or
toPathif the paths are not related.
Exceptions
- ArgumentNullException
fromPath or toPath is null.
- UriFormatException
The URI is incorrectly formed.
- InvalidOperationException
This instance represents a relative URI, and this property is valid only for absolute URIs.