Full-Stack freelance Umbraco developer in the UK.

George Phillipson - Freelance Umbraco developer

C-Sharp Enumerate An Enum

Code for example
using System;
namespace Example
{
    internal static class Program
    {
        private static void Main(string[] args)
        {
            EnumerateOverDogs();
        }
        private enum Dogs
        {
            GermanShepherd,
            GreatPyrenees,
            IrishSetter,
            Keeshond
        }
        private static void EnumerateOverDogs()
        {
            foreach (Dogs dog in Enum.GetValues(typeof(Dogs)))
            {
                Console.WriteLine(dog);
            }
            Console.Read();
        }
    }
}

Please enter your comment.