Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using enum as a parameter
Message
From
22/12/2004 12:44:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00971423
Message ID:
00971500
Views:
18
Einar,
I haven't tested but I think you could write a generic tester using Reflection. Enum members are like field members of a class so might do with checking Type.FieldInfo.
Cetin

>Cetin,
>Hmm I guess I find that a flaw with the enum. I guess that means I have to add code to my method that accepts an enum as a parameter to ensure that the parameter passed is a member of that enum and I hope I can find a way to do this genericly so I don't have to hardcode this.
>Thanks for the information even if it wasn't what I wanted to hear :)
>Einar
>>Einar,
>>By definition (From "C# Language specification"):
>>"The set of values that an enum type can take on is not limited by its enum members. In particular, any value of the underlying type of an enum can be cast to the enum type, and is a distinct valid value of that enum type."
>>
>>You've to check what you get.
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform