How to use “\” in a string without making it an escape sequence - C#?

后端 未结 6 2128
后悔当初
后悔当初 2020-12-14 23:35

I\'m sure this is something really basic that I don\'t know but how do I make it not recognize \"\\\" as an escape sequence inside a string

I\'m trying to type in a

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-15 00:40

    It's Simple... Just put '@' symbol before your string, then it never care for your escape sequences...like this

    string name=@"lndebi\n\nlndebi";

    the output will be lndebi\n\nlndebi.

提交回复
热议问题