What is an Alternative way to retrieve an Enum member by their Name?

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

VB.Net
enum_obj = CType(System.Enum.Parse(GetType(Active_Inactive), "Active"),Active_Inactive)

C#
enum_obj = (Active_Inactive)Enum.Parse(typeof(Active_Inactive), "Active");


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response