public static bool HasAttribute(this MemberInfo info, Type type)
 {
     if (NullCheck(type))
     {
         return(false);
     }
     return(info.IsDefined(type, true));
 }
        public static ConfigSettingAttribute FindConfigSetting(MemberInfo s, bool forceCreate)
        {
            const bool             createIfDeclared = true;
            ConfigSettingAttribute cs0;

            lock (M2C)
            {
                if (!M2C.TryGetValue(s, out cs0))
                {
                    if (createIfDeclared)
                    {
                        if (s.IsDefined(typeof(ConfigSettingAttribute), true))
                        {
                            var cs = s.GetCustomAttributes(typeof(ConfigSettingAttribute), true);
                            if (cs != null && cs.Length > 0)
                            {
                                cs0 = (ConfigSettingAttribute)cs[0];
                                cs0.SetMember(s);
                            }
                            else
                            {
                                cs0 = null;
                            }
                        }
                        M2C[s] = cs0;
                    }
                }
                if (cs0 == null && forceCreate)
                {
                    cs0 = new ConfigSettingAttribute();
                    cs0.SetMember(s);
                    M2C[s] = cs0;
                }
            }
            return(cs0);
        }