PDA

Click to See Complete Forum and Search --> : how to search an enum variable for a specific member?


bnathvbdotnet
May 21st, 2006, 09:52 AM
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

techgnome
May 21st, 2006, 11:03 AM
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

ComputerJy
May 21st, 2006, 04:36 PM
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