TobiasWittenburg TobiasWittenburg - 1 year ago 107 Question

Reserved Keyword in Enumeration in C#

I would like to use

as members of an enumeration. I know that this is possible in VB.NET to write it like this:

Public Enum Test
[as] = 1
[is] = 2
End Enum

How do I write the equivalent statement in C#?
The following code does not compile:

public enum Test
as = 1,
is = 2

Answer Source

Prefixing reserved words in C# is done with @.

public enum Test
    @as = 1,
    @is = 2
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download