首页 > 其他 > 详细

枚举和字符串转换

时间:2014-03-17 18:53:57      阅读:450      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
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);
}
bubuko.com,布布扣


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

枚举和字符串转换,布布扣,bubuko.com

枚举和字符串转换

原文:http://www.cnblogs.com/qixue/p/3605353.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!