Table of Contents

Method MakeRelativePath

Namespace
Alternet.Common
Assembly
Alternet.Common.v9.dll

MakeRelativePath(string, string)

Creates a relative path from one file or folder to another.

public static string MakeRelativePath(string fromPath, string toPath)

Parameters

fromPath string

Contains the directory that defines the start of the relative path.

toPath string

Contains 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.