Hi Following is the sample code to convert integer Enum value to string counterpart:
public enum Gender
{
[Display(Name = @"No
Preference")]
NoPreference = 0,
[Display(Name = @"Male")]
Male = 1,
[Display(Name = @"Female")]
Female = 2
}
Use following code to get string text of enum:
int value_from_database = 1;
string UserGender =
((Gender)value_from_database).ToString();
No comments:
Post a Comment