In C# you can preface any identifier or keyword with the
@ symbol to make it a verbatim identifier. This allows you to use what would normally be reserved keywords, like
for as identifiers, should you need to.
I’m occasionally asked why it is that any identifier can be made into a verbatim identifier. Why not restrict the verbatim identifiers to the reserved and contextual keywords?
The answer is straightforward. Imagine that we are back in the day when C# 2.0 just shipped. You have a C# 1.0 program that uses
yield as an identifier, which is entirely reasonable; “yield” is a common term in many business and scientific applications. Now, C# 2.0 was carefully designed so that C# 1.0 programs that use
yield as an identifier are still legal C# 2.0 programs; it only has its special meaning when it appears before
return, and that never happened in a C# 1.0 program. But still, you decide that you’re going to mark the usages of
yield in your program as verbatim identifiers so that it is more clear to the future readers of the code that it is being used as an identifier, not as part of an iterator.
You wish to do this work before upgrading your entire organization to C# 2.0. It would be both bizarre and counterproductive if doing so made your program no longer a legal C# 1.0 program!