c# - Verbatim string literals v escape sequences -


is there difference in how c# compiler or .net run-time handles verbatim string literals versus using escape sequences (i.e. performance) or matter of design time style? e.g.:

var patha = "c:\\somewhere"; var pathb = @"c:\somewhere"; 

i imagine compiled same , doesn't matter, curious.

any difference here limited strictly compiler; il , runtime have no concept of verbatim vs escaped - has the string.

as choose: whichever more convenient ;p use verbatim string literals if there unusual characters, allows multi-line strings , visually.

as interesting case:

bool aresame = referenceequals("c:\\somewhere", @"c:\somewhere"); // true 

which tells exactly same string instance (thanks "interning"). aren't equivalent; the same string instance runtime. therefore impossible can (to runtime) different in way.


Comments