PC Review


Reply
Thread Tools Rate Thread

Can I use Reflection to see if Member is Enum?

 
 
Lee
Guest
Posts: n/a
 
      13th Mar 2006


Is it possible to use Reflection to determine if a class's member is an
Enumerated Type?

Thank you.

--
Warm Regards,
Lee

"Upon further investigation it appears that your software is missing
just one thing. It definitely needs more cow bell..."
 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      13th Mar 2006
Lee,

Yes it is, when you get the Type of the property/field/method return
value/parameter, just call the IsEnum property on the Type, and check to see
if it is an enumeration.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"Lee" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
>
> Is it possible to use Reflection to determine if a class's member is an
> Enumerated Type?
>
> Thank you.
>
> --
> Warm Regards,
> Lee
>
> "Upon further investigation it appears that your software is missing
> just one thing. It definitely needs more cow bell..."



 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      13th Mar 2006
Lee <(E-Mail Removed)> wrote:
> Is it possible to use Reflection to determine if a class's member is an
> Enumerated Type?


See Type.IsEnum.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
 
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
Access of shared member, constant member, enum member or nested type through an instance Jeffrey Grantz Microsoft VB .NET 3 7th Sep 2006 04:09 PM
how to know an int is the member of an enum type?(C++/CLI) Tau Microsoft VC .NET 9 20th Jan 2006 01:20 AM
Reflection: Member not found error, but member exists---help. phrankbooth@hotmail.com Microsoft Dot NET Framework 2 22nd Nov 2005 08:23 PM
Reflection and Enum Conversion Matt Porco Microsoft Dot NET Framework 8 16th Jul 2004 06:11 PM
Set an Enum property using reflection? =?Utf-8?B?UmFlIEFuZHJld3M=?= Microsoft Dot NET Framework 2 3rd Feb 2004 12:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:48 PM.