How to enumerate an enum in C#?
Below is a sample code snippet that demonstrates how to enumerate an enum in C# using Foreach statement?
How to enumerate an enum in C#?
using System; using System.Collections.Generic; using System.Data; namespace AbundantCode { internal class Program { public enum CodingLanguages { CSharp, Java, Cplusplus, HTML } // How to Enumerate an enum in C# ? private static void Main(string[] args) { foreach (var languages in Enum.GetValues(typeof(CodingLanguages))) { Console.WriteLine(languages); } Console.ReadLine(); } } }

Leave Your Comment