自己写的enum转换的一个扩展,

public static String ToEnumName(this int? source, Type e) {
            if (!source.HasValue) throw new ArgumentException("enum转换title 需要值");
            return Enum.Parse(e, source.Value.ToString()).ToString();
        }

 用法 1.ToEnumName(typeof(AssetEnum))

posted @ 2015-07-19 12:33  calochCN  阅读(171)  评论(0)    收藏  举报