Using C# keywords in your Enums

Sometimes you want to define a value in your enumeration which has the same name as a keyword in C#.

The compiler will not like this:

The solution in C# for this is to prefix your value with the @-character:

namespace EnumTest
{
 //as = attosecond
 public enum Time : byte
 {
 s = 1,
 ms = 2,
 @as = 3
 }
}

For Visual Basic use square brackets like this [as].