• After more than 30 years running websites and forums I am retiring.

    I have made many friends through the years. I will cherish my time getting to know you. I wish you all the best. This was not an easy decision to make. The cost to keep the communities running has gotten to the point where it's just too expensive. Security certificates, hosting cost, software renewals and everything else has increased threefold. While costs are up ad revenue is down. It's no longer viable to keep things running.

    All sites will be turned off on Thursday 30 November 2023. If you are interested in acquiring any of the websites I own you can Email Schwarz Network.

Nested Enums?


Mar 10, 2004
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:

class A
class B
enum C

So that the enum is referenced as A.B.C ... ??


Nov 18, 2003
>> 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.

Joe Mamma

Senior Contributor
Mar 1, 2004
Washington DC
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


Jul 30, 2012
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


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