Mike-Ward.Net

Using Keywords as Identifiers in C#

There are times when keywords and identifiers collide when coding. This is particularly true in code generators but sometimes the keyword really describes the purpose of the identifier (like default or ref for instance). You can come up with clever naming schemes but there is a simpler way. In C#, you can just prefix the identifier with an @ symbol.

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, @if is a legal identifier but if is not because it is a keyword. The C# Language

← newer older →
.Net, Technology, Life, Whatever

Recent Posts

Checklist Buddy Available for Testing
Tweetz 2.0.0 Released
Tweetz 2.0 Beta
VSColorOutput 2.7 - Time Stamps
Fixed Focal-Length Eyeglasses, a Programmer's Best Friend
How to Choose the Right VPN Service
Two Handy Command Line Scripts
More... (1089)

Donate