[c#] C #에서 두 경로를 어떻게 조인합니까?

C #에서 두 파일 경로를 어떻게 결합합니까?



답변

아래 예제와 같이 Path.Combine () 을 사용해야 합니다.

string basePath = @"c:\temp";
string filePath = "test.txt";
string combinedPath = Path.Combine(basePath, filePath);
// produces c:\temp\test.txt


답변

System.IO.Path.Combine () 이 필요합니다.

Path.Combine(path1, path2);


답변