在C#中,可以使用Path類的GetFullPath方法將相對路徑轉化為絕對路徑。例如:
string relativePath = "myFolder/myFile.txt"; string absolutePath = Path.GetFullPath(relativePath); Console.WriteLine(absolutePath);
這樣就會將相對路徑"myFolder/myFile.txt"轉化為絕對路徑,并輸出到控制臺上。