开发者

Environment.GetFolderPath returning incorrect address

Why does

string AssignmentTypesFilename = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\SchoolDayManager\Assign开发者_StackOverflow中文版mentTypes.txt";`

always return

"C:\\\Users\\\Travis Michael\\\Documents\\\SchoolDayManager\\\AssignmentTypes.txt" 

instead of

"C:\Users\Travis Michael\Documents\SchoolDayManager\AssignmentTypes.txt"?


How do you look at the string? Through the debugger's watch window? In the debugger, strings are sometimes escaped before they are displayed. Try displaying it to the user, through

Console.WriteLine(AssignmentTypesFilename);

or if using a WinForm GUI:

MessageBox.Show(AssignmentTypesFilename);

It should be displayed correctly then.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜