c# - How to write a backslash (\) in a string?

I want to write something like this C:\Users\UserName\Documents\Tasks in a textbox:

txtPath.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)+"\Tasks";

I get the error:

Unrecognized escape sequence.

How do I write a backslash in a string?

This question and all comments follow the "Attribution Required."

All Answers

Answers Loading...
Leave a Reply
You must be logged in to post a answer.
About the author