The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,261 other subscribers

naming – What’s the use/meaning of the @ character in variable names in C#? – Stack Overflow

Posted by jpluimers on 2012/03/28

Duh, I always thought @ could only be used for strings.

Not so: just like with the & in Delphi is used to escape keywords, the additional use of @ in C# is to escape identifiers:

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.

–jeroen

via: naming – What’s the use/meaning of the @ character in variable names in C#? – Stack Overflow.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.