How to retrieve Enum values using its GETNAMES Method?

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

As with GETVALUES Method,we can also retrieve the same thing using GETNAMES method.Here,we also have to Loop through Enum values:-
For Each value In [Enum].GetNames(GetType(Active_Inactive))

MessageBox.Show(value)
Next

foreach(string value in Enum.GetNames(typeof(Active_Inactive)))
{
MessageBox.Show(value);
}

Output:-
Active
Inactive


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response