What's the use/meaning of the @ character in variable names in C#?

Straight from the C# Language Specification, Identifiers (C#) :

The prefix "@" enables the use of keywords as identifiers, which is useful when interfacing with other programming languages. The character @ is not actually part of the identifier, so the identifier might be seen in other languages as a normal identifier, without the prefix. An identifier with an @ prefix is called a verbatim identifier.


It just lets you use a reserved word as a variable name. Not recommended IMHO (except in cases like you have).


In C# the at (@) character is used to denote literals that explicitly do not adhere to the relevant rules in the language spec.

Specifically, it can be used for variable names that clash with reserved keywords (e.g. you can't use params but you can use @params instead, same with out/ref/any other keyword in the language specification). Additionally it can be used for unescaped string literals; this is particularly relevant with path constants, e.g. instead of path = "c:\\temp\\somefile.txt" you can write path = @"c:\temp\somefile.txt". It's also really useful for regular expressions.