Answers for "c# relative path"

C#
0

c# relative path to project folder

string fileName = "ich_will.mp3";
string path = Path.Combine(Environment.CurrentDirectory, @"Data", fileName);
Posted by: Guest on September-03-2020
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
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

C# Answers by Framework

Browse Popular Code Answers by Language