System.Attribute.GetParentDefinition C# (CSharp) Метод

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

private static GetParentDefinition ( EventInfo ev ) : EventInfo
ev EventInfo
Результат EventInfo
        private static EventInfo GetParentDefinition(EventInfo ev)
        {
            MethodInfo add = ev.GetAddMethod(true); 
            if (add != null)
            {
                add = add.GetParentDefinition();
                if (add != null) 
                    return add.DeclaringType.GetEvent(ev.Name);
            }
            return null;
        }

Same methods

Attribute::GetParentDefinition ( PropertyInfo property ) : PropertyInfo

Usage Example

Пример #1
0
 private static bool InternalIsDefined(PropertyInfo element, Type attributeType, bool inherit)
 {
     if (element.IsDefined(attributeType, inherit))
     {
         return(true);
     }
     if (inherit && Attribute.InternalGetAttributeUsage(attributeType).Inherited)
     {
         for (PropertyInfo parentDefinition = Attribute.GetParentDefinition(element); parentDefinition != (PropertyInfo)null; parentDefinition = Attribute.GetParentDefinition(parentDefinition))
         {
             if (parentDefinition.IsDefined(attributeType, false))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
All Usage Examples Of System.Attribute::GetParentDefinition