This is a bit awkward .NET interview question which was asked to one of our readers in Capgemini mumbai.
So let’s assume you have the below ENUM and you would like to loop through the same. Probably you would like to display the same in a dropdown.
public enum MyColors
So in the UI ( currently it’s a console application) you can use “ENUM.Getvalues” function and loop through the same.
Below is as simple sample code which loops through the above ENUM MyColors.
static void Main(string args)
foreach (MyColors s in Enum.GetValues(typeof(MyColors)))
Below are 6 important SQL Server interview question with answer video list , you will surely enjoy the same.