Example #1
0
        public static void Generate(
            TypeBuilder typeBuilder,
            EventMetadata eventMetadata, 
            MethodBuilder addMethod,
            MethodBuilder removeMethod,
            MethodBuilder raiseMethod)
        {
            var @event = typeBuilder.DefineEvent(
                eventMetadata.Name,
                eventMetadata.EventAttributes,
                eventMetadata.EventHandlerType);

            if (addMethod != null)
            {
                @event.SetAddOnMethod(addMethod);
            }

            if (removeMethod != null)
            {
                @event.SetRemoveOnMethod(removeMethod);
            }

            if (raiseMethod != null)
            {
                @event.SetRaiseMethod(raiseMethod);
            }
        }
Example #2
0
 public TypeMetadata(
     string name,
     Type baseType,
     Type[] interfaces,
      DispatcherFieldMetadata dispatcherField,
     FieldMetadata[] fields,
     ConstructorMetadata[] constructors, 
     MethodMetadata[] methods, 
     PropertyMetadata[] properties, 
     EventMetadata[] events, 
     TargetMetadata[] targets)
 {
     _name = name;
     _baseType = baseType;
     _interfaces = interfaces;
     _dispatcherField = dispatcherField;
     _fields = fields;
     _constructors = constructors;
     _methods = methods;
     _properties = properties;
     _events = events;
     _targets = targets;
 }