|
-
May 21st, 2006, 09:52 AM
#1
Thread Starter
Hyperactive Member
how to search an enum variable for a specific member?
I have declared an enum as
enum PaymentFrequency : int
{
Monthly = 12,
Quarterly = 4,
SemiAnnual = 4,
Annual = 1
};
in the method I am writing, the parameter passed is any one of items in the enum (say Annual).
How to search an enum variable for 'Annual' and get the value which is 1 here.
thanks
nath
-
May 21st, 2006, 11:03 AM
#2
Re: how to search an enum variable for a specific member?
You don't search for enum values. They simply are. If the variable is of that enum type, then the variable's value would be the value you are looking for,.
-tg
-
May 21st, 2006, 04:36 PM
#3
Re: how to search an enum variable for a specific member?
 Originally Posted by bnathvbdotnet
I have declared an enum as
enum PaymentFrequency : int
{
Monthly = 12,
Quarterly = 4,
SemiAnnual = 4,
Annual = 1
};
in the method I am writing, the parameter passed is any one of items in the enum (say Annual).
How to search an enum variable for 'Annual' and get the value which is 1 here.
thanks
nath
cast it to (int)
or use a switch
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|