about enum

T

tony

Hello!

If you have this enum test declaration can see get the number of items in
this enum.
In this case it's 6.

Can I use some suitable metods or some statement to get this 6 in some way.

enum test : byte {a,b,c,d,e,f};

//Tony
 
J

Jono

You could use the Enum.GetNames(typeof(test)) method and then examine
the Length property of the resulting string[].

Regards,

Jono
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

about enum 3
enum type 3
[Flags] Enum -- make it better 1
I have small probalem 4
Iterate through enum of system.drawing.color 5
Have some problem with enum and string 8
same Enum and property 12
enum (error) 2

Top