Monday, February 11, 2013

How to TryParse Enum?

    public enum color
    {
        red =1, blue=2
    }

            color result;
            bool IsParsingCorrect = Enum.TryParse("red", true, out result);
            IsParsingCorrect = Enum.TryParse("green", true, out result);

No comments:

Post a Comment