Using the literal '@' with a string variable

后端 未结 6 775
Happy的楠姐
Happy的楠姐 2020-12-17 01:42

I have a helper class pulling a string from an XML file. That string is a file path (so it has backslashes in it). I need to use that string as it is... How can I use it lik

6条回答
  •  清酒与你
    2020-12-17 02:05

    You've got it backwards. The @-operator is for turning literals into strings, while keeping all funky characters. Your path is already a string - you don't need to do anything at all to it. Just lose the @.

    string filePath = helper.getFilePath();
    

提交回复
热议问题