verbatim

Verbatim string literals v escape sequences

强颜欢笑 提交于 2019-11-26 14:45:33
问题 Is there any difference in how the C# compiler or .NET run-time handles verbatim string literals versus using escape sequences (i.e. performance) or is it just a matter of design time style? E.G.: var pathA = "c:\\somewhere"; var pathB = @"c:\somewhere"; I would imagine they are compiled the same and it doesn't matter, but was just curious. 回答1: Any difference here is limited strictly to the compiler; the IL and runtime have no concept of verbatim vs escaped - it just has the string . As for