internal GenericEventInfo(Type typeInstance, EventInfo eventInfo)
		{
			this.typeInstance = typeInstance;
			this.eventInfo = eventInfo;
		}
Exemple #2
0
        public IUnresolvedEvent ReadEvent(EventInfo ev, IUnresolvedTypeDefinition parentType)
        {
            if (ev == null)
                throw new ArgumentNullException("ev");
            if (parentType == null)
                throw new ArgumentNullException("parentType");

            DefaultUnresolvedEvent e = new DefaultUnresolvedEvent(parentType, ev.Name);
            TranslateModifiers(ev.AddMethod, e);
            e.ReturnType = ReadTypeReference(ev.EventHandlerType, typeAttributes: ev.CustomAttributes);

            e.AddAccessor    = ReadMethod(ev.AddMethod,    parentType, EntityType.Accessor, e);
            e.RemoveAccessor = ReadMethod(ev.RemoveMethod, parentType, EntityType.Accessor, e);
            e.InvokeAccessor = ReadMethod(ev.RaiseMethod, parentType, EntityType.Accessor, e);

            AddAttributes(ev, e);

            var accessor = e.AddAccessor ?? e.RemoveAccessor ?? e.InvokeAccessor;
            if (accessor != null && accessor.IsExplicitInterfaceImplementation) {
                e.Name = ev.Name.Substring(ev.Name.LastIndexOf('.') + 1);
                e.IsExplicitInterfaceImplementation = true;
                foreach (var mr in accessor.ExplicitInterfaceImplementations) {
                    e.ExplicitInterfaceImplementations.Add(new AccessorOwnerMemberReference(mr));
                }
            }

            FinishReadMember(e, ev);

            return e;
        }
Exemple #3
0
 void AddAttributes(EventInfo eventDefinition, IUnresolvedEntity targetEntity)
 {
     AddCustomAttributes(eventDefinition.CustomAttributes, targetEntity.Attributes);
 }
		internal EventInfoWithReflectedType(Type reflectedType, EventInfo eventInfo)
		{
			Debug.Assert(reflectedType != eventInfo.DeclaringType);
			this.reflectedType = reflectedType;
			this.eventInfo = eventInfo;
		}