当前位置: 首页>>代码示例>>C#>>正文


C# EventInfo.GetCustomAttributes方法代码示例

本文整理汇总了C#中System.Reflection.EventInfo.GetCustomAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# EventInfo.GetCustomAttributes方法的具体用法?C# EventInfo.GetCustomAttributes怎么用?C# EventInfo.GetCustomAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.EventInfo的用法示例。


在下文中一共展示了EventInfo.GetCustomAttributes方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateMBeanNotificationInfo

 public MBeanNotificationInfo CreateMBeanNotificationInfo(EventInfo info, Type handlerType)
 {
     MBeanNotificationAttribute attribute =
     (MBeanNotificationAttribute)info.GetCustomAttributes(typeof(MBeanNotificationAttribute), true)[0];
      return new MBeanNotificationInfo(new[] { attribute.NotifType },
                                   handlerType.GetGenericArguments()[0].AssemblyQualifiedName,
                                   InfoUtils.GetDescrition(info, info, "MBean notification"));
 }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:8,代码来源:OpenMBeanBeanInfoFactory.cs

示例2: GetEndTrigger

 private static DynamicMethodDelegate GetEndTrigger(EventInfo info)
 {
   EndTriggerAttribute triggerAttribute = Enumerable.FirstOrDefault<object>((IEnumerable<object>) info.GetCustomAttributes(typeof (EndTriggerAttribute), false)) as EndTriggerAttribute;
   if (triggerAttribute == null)
     return (DynamicMethodDelegate) null;
   else
     return ReflectionHelper.CreateDelegate((MethodBase) info.DeclaringType.GetEvent(triggerAttribute.Trigger).GetAddMethod());
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:8,代码来源:EntityTypes.cs

示例3: ReflectionEventDescriptor

		public ReflectionEventDescriptor (EventInfo eventInfo) : base (eventInfo.Name, (Attribute[]) eventInfo.GetCustomAttributes (true))
		{
			_eventInfo = eventInfo;
			_componentType = eventInfo.DeclaringType;
			_eventType = eventInfo.EventHandlerType;

			add_method = eventInfo.GetAddMethod ();
			remove_method = eventInfo.GetRemoveMethod ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:ReflectionEventDescriptor.cs

示例4: InternalGetCustomAttributes

 private static Attribute[] InternalGetCustomAttributes(EventInfo element, Type type, bool inherit)
 {
   Attribute[] attributes = (Attribute[]) element.GetCustomAttributes(type, inherit);
   if (!inherit)
     return attributes;
   Hashtable types = new Hashtable(11);
   ArrayList attributeList = new ArrayList();
   Attribute.CopyToArrayList(attributeList, attributes, types);
   for (EventInfo parentDefinition = Attribute.GetParentDefinition(element); parentDefinition != null; parentDefinition = Attribute.GetParentDefinition(parentDefinition))
   {
     Attribute[] customAttributes = Attribute.GetCustomAttributes((MemberInfo) parentDefinition, type, false);
     Attribute.AddAttributesToList(attributeList, customAttributes, types);
   }
   return (Attribute[]) attributeList.ToArray(type);
 }
开发者ID:consumentor,项目名称:Server,代码行数:15,代码来源:Attribute.cs

示例5: InternalGetCustomAttributes

 private static Attribute[] InternalGetCustomAttributes(EventInfo element, Type type, bool inherit)
 {
   Attribute[] attributes = (Attribute[]) element.GetCustomAttributes(type, inherit);
   if (!inherit)
     return attributes;
   Dictionary<Type, AttributeUsageAttribute> types = new Dictionary<Type, AttributeUsageAttribute>(11);
   List<Attribute> attributeList = new List<Attribute>();
   Attribute.CopyToArrayList(attributeList, attributes, types);
   for (EventInfo parentDefinition = Attribute.GetParentDefinition(element); parentDefinition != (EventInfo) null; parentDefinition = Attribute.GetParentDefinition(parentDefinition))
   {
     Attribute[] customAttributes = Attribute.GetCustomAttributes((MemberInfo) parentDefinition, type, false);
     Attribute.AddAttributesToList(attributeList, customAttributes, types);
   }
   Array destinationArray = (Array) Attribute.CreateAttributeArrayHelper(type, attributeList.Count);
   Array.Copy((Array) attributeList.ToArray(), 0, destinationArray, 0, attributeList.Count);
   return (Attribute[]) destinationArray;
 }
开发者ID:consumentor,项目名称:Server,代码行数:17,代码来源:Attribute.cs

示例6: InternalGetCustomAttributes

		private static Attribute[] InternalGetCustomAttributes(EventInfo element, Type type, bool inherit)
		{
			Attribute[] array = (Attribute[])element.GetCustomAttributes(type, inherit);
			if (inherit)
			{
				Dictionary<Type, AttributeUsageAttribute> types = new Dictionary<Type, AttributeUsageAttribute>(11);
				List<Attribute> list = new List<Attribute>();
				Attribute.CopyToArrayList(list, array, types);
				EventInfo parentDefinition = Attribute.GetParentDefinition(element);
				while (parentDefinition != null)
				{
					array = Attribute.GetCustomAttributes(parentDefinition, type, false);
					Attribute.AddAttributesToList(list, array, types);
					parentDefinition = Attribute.GetParentDefinition(parentDefinition);
				}
				Array array2 = Attribute.CreateAttributeArrayHelper(type, list.Count);
				Array.Copy(list.ToArray(), 0, array2, 0, list.Count);
				return (Attribute[])array2;
			}
			return array;
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:21,代码来源:Attribute.cs

示例7: WriteCustomAttributes

		private void WriteCustomAttributes(XmlWriter writer, EventInfo eventInfo)
		{
			try
			{
				WriteCustomAttributes(writer, eventInfo.GetCustomAttributes(this.rep.DocumentInheritedAttributes), "");
			}
			catch (Exception e)
			{
				TraceErrorOutput("Error retrieving custom attributes for " + MemberID.GetMemberID(eventInfo), e);
			}
		}
开发者ID:ceefour,项目名称:aphrodox,代码行数:11,代码来源:ReflectionEngine.cs

示例8: InternalGetCustomAttributes

        private static Attribute[] InternalGetCustomAttributes(EventInfo element, Type type, bool inherit)
        {
            Contract.Requires(element != null);
            Contract.Requires(type != null);
            Contract.Requires(type.IsSubclassOf(typeof(Attribute)) || type == typeof(Attribute));

            // walk up the hierarchy chain
            Attribute[] attributes = (Attribute[])element.GetCustomAttributes(type, inherit);
            if (inherit)
            {
                // create the hashtable that keeps track of inherited types
                Dictionary<Type, AttributeUsageAttribute> types = new Dictionary<Type, AttributeUsageAttribute>(11);
                // create an array list to collect all the requested attibutes
                List<Attribute> attributeList = new List<Attribute>();
                CopyToArrayList(attributeList, attributes, types);

                EventInfo baseEvent = GetParentDefinition(element);
                while (baseEvent != null)
                {
                    attributes = GetCustomAttributes(baseEvent, type, false);
                    AddAttributesToList(attributeList, attributes, types);
                    baseEvent = GetParentDefinition(baseEvent);
                }
                Array array = CreateAttributeArrayHelper(type, attributeList.Count);
                Array.Copy(attributeList.ToArray(), 0, array, 0, attributeList.Count);
                return (Attribute[])array;
            }
            else
                return attributes;
        }
开发者ID:Clockwork-Muse,项目名称:coreclr,代码行数:30,代码来源:Attribute.cs

示例9: InternalGetCustomAttributes

 private static Attribute[] InternalGetCustomAttributes(EventInfo element, Type type, bool inherit)
 {
     Attribute[] customAttributes = (Attribute[]) element.GetCustomAttributes(type, inherit);
     if (!inherit)
     {
         return customAttributes;
     }
     Dictionary<Type, AttributeUsageAttribute> types = new Dictionary<Type, AttributeUsageAttribute>(11);
     List<Attribute> attributeList = new List<Attribute>();
     CopyToArrayList(attributeList, customAttributes, types);
     for (EventInfo info = GetParentDefinition(element); info != null; info = GetParentDefinition(info))
     {
         customAttributes = GetCustomAttributes(info, type, false);
         AddAttributesToList(attributeList, customAttributes, types);
     }
     Array destinationArray = CreateAttributeArrayHelper(type, attributeList.Count);
     Array.Copy(attributeList.ToArray(), 0, destinationArray, 0, attributeList.Count);
     return (Attribute[]) destinationArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:Attribute.cs

示例10: InternalGetCustomAttributes

        private static Attribute[] InternalGetCustomAttributes(EventInfo element, Type type, bool inherit)
        {
            // walk up the hierarchy chain
            Attribute[] attributes = (Attribute[])element.GetCustomAttributes(type, inherit);
            if (inherit) {
                // create the hashtable that keeps track of inherited types
                Hashtable types = new Hashtable(11);
                // create an array list to collect all the requested attibutes
                ArrayList attributeList = new ArrayList();
                CopyToArrayList(attributeList, attributes, types);

                EventInfo baseEvent = GetParentDefinition(element);
                while (baseEvent != null) {
                    attributes = GetCustomAttributes(baseEvent, type, false);
                    AddAttributesToList(attributeList, attributes, types);
                    baseEvent = GetParentDefinition(baseEvent);
                }
                return (Attribute[])attributeList.ToArray(type);
            }
            else
                return attributes;
        }
开发者ID:ArildF,项目名称:masters,代码行数:22,代码来源:attribute.cs

示例11: InternalGetCustomAttributes

 private static Attribute[] InternalGetCustomAttributes(EventInfo element, Type type, bool inherit)
 {
     Attribute[] customAttributes = (Attribute[]) element.GetCustomAttributes(type, inherit);
     if (!inherit)
     {
         return customAttributes;
     }
     Hashtable types = new Hashtable(11);
     ArrayList attributeList = new ArrayList();
     CopyToArrayList(attributeList, customAttributes, types);
     for (EventInfo info = GetParentDefinition(element); info != null; info = GetParentDefinition(info))
     {
         customAttributes = GetCustomAttributes(info, type, false);
         AddAttributesToList(attributeList, customAttributes, types);
     }
     return (Attribute[]) attributeList.ToArray(type);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:17,代码来源:Attribute.cs

示例12: EventPropertyDescriptor

 public EventPropertyDescriptor(EventInfo ev) :
     base(ev.Name, (Attribute[]) ev.GetCustomAttributes(typeof(Attribute), true))
 {
     _event = ev;           
 }
开发者ID:petya2164,项目名称:ZsharpGameEditor,代码行数:5,代码来源:EventsTab.cs


注:本文中的System.Reflection.EventInfo.GetCustomAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。