枚举和字符串转换

public static String convertToString(this Enum eff)
{
    return Enum.GetName(eff.GetType(), eff);
}

public static EnumType converToEnum<EnumType>(this String enumValue)  
{
    return (EnumType) Enum.Parse(typeof(EnumType), enumValue);
}


post from : http://stackoverflow.com/questions/483794/convert-enum-to-string

原文地址:https://www.cnblogs.com/qixue/p/3605353.html