How to retrieve Enum value using its GetValues method?

 Posted by vishalneeraj-24503 on 8/5/2014 | Category: Visual Studio Interview questions | Views: 2100 | Points: 40
Answer:

As name suggests,GetValues method have array values.So we can Loop through Enum Values as:-

//C#
foreach(int value in Enum.GetValues(typeof(Active_Inactive)))
{
MessageBox.Show(value);
}
'VB.Net
For Each value In [Enum].GetValues(GetType(Active_Inactive))
MessageBox.Show(value)
Next


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response