Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to get relative path in c#

Uri file = new Uri(@"c:fooarloplap.txt");
// Must end in a slash to indicate folder
Uri folder = new Uri(@"c:fooar");
string relativePath = 
Uri.UnescapeDataString(
    folder.MakeRelativeUri(file)
        .ToString()
        .Replace('/', Path.DirectorySeparatorChar)
    );
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #relative #path
ADD COMMENT
Topic
Name
3+8 =