public static ICollection GetEnumNames(Type EnumType) { EnumDataCache dc; if (!EnumCache.TryGetValue(EnumType, out dc)) { dc = new EnumDataCache(EnumType); EnumCache.Add(EnumType, dc); } return(dc.GetNames()); }
public static object GetEnumValue(Type EnumType, object DataName) { EnumDataCache dc; if (!EnumCache.TryGetValue(EnumType, out dc)) { dc = new EnumDataCache(EnumType); EnumCache.Add(EnumType, dc); } if (DataName.GetType() == typeof(string)) { return(dc.GetValue((string)DataName)); } else { return(DataName); } }
public static string GetEnumName(Type EnumType, object Value) { if (EnumType == typeof(string)) { return((string)Value); } EnumDataCache dc; if (!EnumCache.TryGetValue(EnumType, out dc)) { dc = new EnumDataCache(EnumType); EnumCache.Add(EnumType, dc); } if (Value.GetType() == typeof(int)) { Value = Enum.ToObject(EnumType, Value); } return(dc.GetName(Value)); }