How to retrieve Enum value using its GETNAME Method?

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

GetName is a static method,so we can directly access this by Enum_Name.GetName as shown below:-
MsgBox([Enum].GetName(GetType(Active_Inactive),1)) //Where 1 is an Index Position of Enum Values

Output:-
Active

MessageBox.Show(Enum.GetName(typeof(Active_Inactive),2));

Output:-
Inactive


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response