HiveBrain v1.2.0
Get Started
← Back to all entries
patterncsharpCritical

What does the @ symbol before a variable name mean in C#?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
namethedoesmeanvariablebeforewhatsymbol

Problem

I understand that the @ symbol can be used before a string literal to change how the compiler parses the string. But what does it mean when a variable name is prefixed with the @ symbol?

Solution

The @ symbol allows you to use reserved word. For example:

int @class = 15;


The above works, when the below wouldn't:

int class = 15;

Code Snippets

int @class = 15;
int class = 15;

Context

Stack Overflow Q#429529, score: 825

Revisions (0)

No revisions yet.