Cast enum to integer
Posted
by
Shanish
on Stack Overflow
See other posts from Stack Overflow
or by Shanish
Published on 2012-06-22T15:13:17Z
Indexed on
2012/06/22
15:16 UTC
Read the original article
Hit count: 195
I have a enum class called Gender
and I have values in this like
public enum GENDER
{
MALE = 1,
FAMALE = 2,
OTHERS = 3,
}
and in my business object I just created a property for this like
public GENDER Gender
{
get
{
return gender;
}
set
{
gender = value;
}
}
in my database its in type integer
. For this I tried to assign the Gender
value in the add function by its name Gender
. but its showing error. Is it possible to cast the enum to integer so that it'll get the value automatically.
can anyone help me out here....
© Stack Overflow or respective owner