how can I get all the content from a enum ?

  • Thread starter Thread starter Kylin
  • Start date Start date
Hi Kylin,

You can use GetNames or GetValues method of Enum to retrieve the content of
an enum. Here is an example:

Dim s As String
For Each s In [Enum].GetNames(GetType(Colors))
Console.WriteLine(s)
Next s

Hope this helps.
Mona [GrapeCity]
 
Just a note that he is probably looking for GetValues as it returns the
actual values.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Mona said:
Hi Kylin,

You can use GetNames or GetValues method of Enum to retrieve the content
of an enum. Here is an example:

Dim s As String
For Each s In [Enum].GetNames(GetType(Colors))
Console.WriteLine(s)
Next s

Hope this helps.
Mona [GrapeCity]
Kylin said:
eg:
I want to get all the content in SqlDbType ,
and save this to a array ...
any help ?



--
FireCrow Studio
Kylin Garden
QQ:462042991
MSN:[email protected]
ICQ:156134382
 
Back
Top