我在 a 中使用 \ 来获取文件路径
string driveLetter = "C:\\";
string folderName = "324Files";
string fileName = "rpt3434.txt";
string stringPath = driveLetter + "MainFolder\\Report" + folderName + "\\" + fileName;
我想改用@,但发现它更麻烦:
string driveLetter = @"C:\";
string folderName = "324Files";
string fileName = "rpt3434.txt";
string stringPath = driveLetter + @"MainFolder\Report" + FolderName + @"\" + fileName;
我想知道哪一种是首选的方法?