.Net > Enumerations > Beginner Next/Skip this question

What would be the output of following code snippet?

using System;

class Program
{
    enum MyColorEnum
    {
        Red,
        Blue,
        Green
    };

    static void Main()
    {
        MyColorEnum value = new MyColorEnum();
        value = (MyColorEnum)2;

        switch (value)
        {
            case MyColorEnum.Red: Console.WriteLine("Red");
                break;
            case MyColorEnum.Blue: Console.WriteLine("Blue");
                break;
            case MyColorEnum.Green: Console.WriteLine("Green");
                break;
        }

        Console.ReadLine();
    }
}
Answers :
Explaination :
social share share on facebook share on twitter share on google plus share on linkedin
Add Comments :

Login

Register

Next Question