You can use reserved identifiers as variable names in C#

TIL you can use reserved identifiers in C# if you use >@ as a prefix.

According to the C# docs:

Keywords are predefined, reserved identifiers that have special meanings to the compiler. They cannot be used as identifiers in your program unless they include @ as a prefix.

For example, @int is a valid identifier, but int is not because int is a keyword.

The identifier—without the @ as prefix—can be seen as a normal identifier in other languages, because the character @ is actually not part of the identifier.

This can be useful when you are interfacing with other programming languages. 🧐


SHARE THIS ARTICLE