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
fromPath
stringContains the directory that defines the start of the relative path.
toPath
stringContains the path that defines the endpoint of the relative path.
Returns
- string
The relative path from the start directory to the end path or
toPath
if 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.