Answers for "c# relative filepath"

C#
0

relative path c#

var outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly(). CodeBase);
var iconPath = Path.Combine(outPutDirectory, "Folder\Img.jpg");
string icon_path = new Uri(iconPath ).LocalPath;
Posted by: Guest on November-17-2021
0

how to get relative path in c#

Uri file = new Uri(@"c:foobarblopblap.txt");
// Must end in a slash to indicate folder
Uri folder = new Uri(@"c:foobar");
string relativePath = 
Uri.UnescapeDataString(
    folder.MakeRelativeUri(file)
        .ToString()
        .Replace('/', Path.DirectorySeparatorChar)
    );
Posted by: Guest on September-30-2020

C# Answers by Framework

Browse Popular Code Answers by Language