Exemple #1
0
        public static string Get(Type tp, string name)
        {
            MemberInfo[] mi = tp.GetMember(name);

            if (mi != null && mi.Length > 0)
            {
                CountryAttribute attr = GetCustomAttribute(mi[0],
                                                           typeof(CountryAttribute)) as CountryAttribute;
                if (attr != null)
                {
                    return(attr.country);
                }
            }
            return(null);
        }
Exemple #2
0
        public static string Get(object enm)
        {
            if (enm != null)
            {
                MemberInfo[] mi = enm.GetType().GetMember(enm.ToString());

                if (mi != null && mi.Length > 0)
                {
                    CountryAttribute attr = GetCustomAttribute(mi[0],
                                                               typeof(CountryAttribute)) as CountryAttribute;
                    if (attr != null)
                    {
                        return(attr.country);
                    }
                }
            }
            return(null);
        }