PC Review


Reply
Thread Tools Rate Thread

how can I get all the content from a enum ?

 
 
Kylin
Guest
Posts: n/a
 
      15th Jul 2005
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:(E-Mail Removed)
ICQ:156134382



 
Reply With Quote
 
 
 
 
Mona
Guest
Posts: n/a
 
      15th Jul 2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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:(E-Mail Removed)
> ICQ:156134382
>
>
>



 
Reply With Quote
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      15th Jul 2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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:(E-Mail Removed)
>> ICQ:156134382
>>
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Defining enum inside of enum? Brett Romero Microsoft C# .NET 6 17th Jan 2006 06:31 AM
Alternatives to Enum.Parse and Enum.Format ME Microsoft Dot NET 4 18th May 2005 10:07 AM
Alternatives to Enum.Parse and Enum.Format ME Microsoft Dot NET Compact Framework 4 18th May 2005 10:07 AM
Is enum type derived from Enum struct? Jerry Microsoft C# .NET 3 23rd Oct 2004 06:12 AM
Casting a value from a table to an Enum using Enum.ToObject KyleK Microsoft C# .NET 1 11th May 2004 04:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:22 PM.