Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     

How can we loop through ENUM values( C# ENUM Interview questions with answers)?

We can use “GetValues()” method of the “ENUM” class which returns an array of enum values.

var x = Enum.GetValues(typeof(MyColors));

What is the use of “ENUM.Parse” method?

“ENUM.Parse” parses string to an ENUM value. Like in the below code we pass “Green” string value and it gets type casted to enum which has green enum as a constant.

Helpful Website Url
Share this article   |    Print    |    Article read by 4934 times
Shivprasad koirala Koirala
I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small E-learning company in India. We are very much active in making training videos , writing books and corporate trainings. Do visit my site for .NET, C# , design pattern , WCF , Silverlight , LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server training and Interview questions and answers
Related Articles: No related article
Related Interview Questions: No related interview question