Trying to save file path into a string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Trying to save file path into a string

Hi I will need a specific file path to be used multiple times in my code and I would like to make it as easy to change the file path as possible. Therefore I'm trying to save the file path into a string but I get errors because of backslashes. Is there any way to fix this? Here is my string: string FilePath = '@"\\[NAS IP]\[Shared folder]\[path...]"'; This is the error I get on all backslashes: error CS1009: Unrecognized escape sequence error CS1012: Too many characters in character literal Thank you very much for your help

26th Feb 2020, 8:33 AM
Martin Ferenec
Martin Ferenec - avatar
1 Answer
+ 2
Change backward (\) to forward (/) slash
26th Feb 2020, 9:01 AM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar