How to Access Variables that having Same name as C# Keyword

How to Access Variables that having Same name as C# Keyword

This is my first blog on c-sharpcorner.com :)


C# language gives you much more flexibility so that you can have same name as c# keyword to your variable ..

Here is Technique how you can access such variable names..

we can access variable that have same name as keyword by using @ symbol before variable name

for example we want to create variable with name 'int' but its a keyword so we need to write @ before variable name like


int @int = 10;

//accessing the variable

Console.WriteLine(@int.ToString());