.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 obj = new MyColorEnum(); //After this statement, obj is Red
        if (Enum.TryParse("1", out obj))
            Console.WriteLine(obj.ToString());
        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