public enum Question
{
Role = 2,
ProjectFunding = 3,
TotalEmployee = 4,
NumberOfServers = 5,
TopBusinessConcern = 6
}
int something = (int) Question.Role;
public class EnumValue
{
public string Name { get; set; }
public int Value { get; set; }
}
public static List<EnumValue> GetValues<T>()
{
List<EnumValue> values = new List<EnumValue>();
foreach (var itemType in Enum.GetValues(typeof(YourEnumClass)))
{
//For each value of this enumeration, add a new EnumValue instance
values.Add(new EnumValue()
{
Name = Enum.GetName(typeof(YourEnumClass), itemType),
Value = (int)itemType
});
}
return values;
}
public enum Question
{
Role = 2,
ProjectFunding = 3,
TotalEmployee = 4,
NumberOfServers = 5,
TopBusinessConcern = 6
}
int something = (int) Question.Role;
Question something_else = (Question) something;