Enum.TryParse method not-support ?

I want to use the method “Enum.TryParse()” (which in NET4.0),

it build successful in MonoDevelop-Unity,
but UnityEditor got an error “error CS0117: System.Enum' does not contain a definition for TryParse’”
(My Unity version is 4.5.2f1)

Dose lastest version support it?

No, Unity uses Mono 2.6, which is approximately .NET 3.5 and does not have Enum.TryParse.

Late help : but its answered in this post (by Thorarin). Just needed it too :slight_smile:

public static TEnum ToEnum<TEnum>(this string strEnumValue, TEnum defaultValue)
{
    if (!Enum.IsDefined(typeof(TEnum), strEnumValue))
        return defaultValue;

    return (TEnum)Enum.Parse(typeof(TEnum), strEnumValue);
}