IsUserCattrProvider() статический приватный Метод

static private IsUserCattrProvider ( object obj ) : bool
obj object
Результат bool
Пример #1
0
        internal static bool IsDefined(ICustomAttributeProvider obj, Type attributeType, bool inherit)
        {
            if (attributeType == null)
            {
                throw new ArgumentNullException("attributeType");
            }
            if (MonoCustomAttrs.IsUserCattrProvider(obj))
            {
                return(obj.IsDefined(attributeType, inherit));
            }
            if (MonoCustomAttrs.IsDefinedInternal(obj, attributeType))
            {
                return(true);
            }
            object[] pseudoCustomAttributes = MonoCustomAttrs.GetPseudoCustomAttributes(obj, attributeType);
            if (pseudoCustomAttributes != null)
            {
                for (int i = 0; i < pseudoCustomAttributes.Length; i++)
                {
                    if (attributeType.IsAssignableFrom(pseudoCustomAttributes[i].GetType()))
                    {
                        return(true);
                    }
                }
            }
            ICustomAttributeProvider @base;

            return(inherit && (@base = MonoCustomAttrs.GetBase(obj)) != null && MonoCustomAttrs.IsDefined(@base, attributeType, inherit));
        }
Пример #2
0
 internal static object[] GetCustomAttributesBase(ICustomAttributeProvider obj, Type attributeType)
 {
     object[] array;
     if (MonoCustomAttrs.IsUserCattrProvider(obj))
     {
         array = obj.GetCustomAttributes(attributeType, true);
     }
     else
     {
         array = MonoCustomAttrs.GetCustomAttributesInternal(obj, attributeType, false);
     }
     object[] pseudoCustomAttributes = MonoCustomAttrs.GetPseudoCustomAttributes(obj, attributeType);
     if (pseudoCustomAttributes != null)
     {
         object[] array2 = new object[array.Length + pseudoCustomAttributes.Length];
         Array.Copy(array, array2, array.Length);
         Array.Copy(pseudoCustomAttributes, 0, array2, array.Length, pseudoCustomAttributes.Length);
         return(array2);
     }
     return(array);
 }