views:

265

answers:

2

I'm finding this in some legacy code and just curious what the brackets are for?

Public Enum myEnum
    none = 0
    abc = 2
    def = 4
    ghi= 6
    [jkl] = 8
    mno = 9
End Enum
+4  A: 

Brackets are usually used when you want to use a keyword for a variable, classname, function name, or something else where using a keyword would usually be not allowed. Here is a list of the vb.net keywords.

Kibbee
+7  A: 

They're not needed in the example you provided, which I assume you have obscured, but the brackets let you specify a name for an enum item that would otherwise conflict with a reserved word.

JeffK