Nested Enums?

JDYoder said:
I don't suppose this is possible in VB.NET, is it?

No, but I suspect that what you might want is just to nest classes to get the desired qualification:

e.g.,
class A
class B
enum C
...

So that the enum is referenced as A.B.C ... ??
 
>> An enum is just a list of consts, why would you need to nest them?

For easy categorizing.



Jaco -- Yeah, for something like that. I wondered if I'd have to do it that way with classes, so I'll just do that. Thanks.
 
JDYoder said:
>> An enum is just a list of consts, why would you need to nest them?

For easy categorizing.
What are you trying to model? Sets of enums? Sets are one thing missing from the .Net framework but there is an implementation from preilly's C# cookbook here. Look at chapter 10. recipe 10.8
 
Did you mean retrieving the full nested string name of an enum (e.g. System.Tools.Enums)?

Try This:

Dim x as System.Tools.SomeEnums = System.Tools.SomeEnums.FartKnocker
Dim y as String = GetType(x).ToString

Where:

Enum SomeEnums
FartKnocker = 1
JabberJaw = 2
None = 0
End Enum
 
Back
Top