public string Get(Type tp, string name) { MemberInfo[] member = tp.GetMember(name); if ((member != null) && (member.Length != 0)) { Attrb customAttribute = Attribute.GetCustomAttribute(member[0], typeof(Attrb)) as Attrb; if (customAttribute != null) { return(customAttribute.Nm); } } return(null); }
public string Get(object enm) { if (enm == null) { MemberInfo[] member = enm.GetType().GetMember(enm.ToString()); if ((member != null) && (member.Length != 0)) { Attrb customAttribute = Attribute.GetCustomAttribute(member[0], typeof(Attrb)) as Attrb; if (customAttribute != null) { return(customAttribute.Nm); } } } return(null); }