C# @“” how do i insert a tab?

后端 未结 12 1266
南笙
南笙 2021-01-17 08:02

Recently i found out i can write in a \" by writing two \" ex @\"abc\"\"def\". I find the @ string literal useful. But how do i write in a tab or n

12条回答
  •  独厮守ぢ
    2021-01-17 08:13

    None of the normal escape sequences work in verbatim string literals (that's the point!). If you want a tab in there, you'll either have to put the actual tab character in, or use string concatenation:

    string x = @"some\stuff" + "\t" + @"some more stuff";
    

    What are you using a verbatim string literal for in the first place? There may be a better way of handling it.

提交回复
热议问题