public CustomEventEmitter(CustomClassEmitter declaringType, string name, EventKind eventKind, Type eventType, EventAttributes attributes) { ArgumentUtility.CheckNotNull("declaringType", declaringType); ArgumentUtility.CheckNotNullOrEmpty("name", name); ArgumentUtility.CheckNotNull("eventType", eventType); _declaringType = declaringType; _eventBuilder = declaringType.TypeBuilder.DefineEvent(name, attributes, eventType); _name = name; _eventKind = eventKind; _eventType = eventType; declaringType.RegisterEventEmitter(this); }
public CustomMethodEmitter(CustomClassEmitter declaringType, string name, MethodAttributes attributes, MethodInfo methodToUseAsATemplate) { ArgumentUtility.CheckNotNull("declaringType", declaringType); ArgumentUtility.CheckNotNullOrEmpty("name", name); ArgumentUtility.CheckNotNull("attributes", attributes); ArgumentUtility.CheckNotNull("methodToUseAsATemplate", methodToUseAsATemplate); MethodEmitter innerEmitter = declaringType.InnerEmitter.CreateMethod(name, attributes, methodToUseAsATemplate); _innerEmitter = innerEmitter; _declaringType = declaringType; _name = name; _parameterTypes = _innerEmitter.Arguments.Select(a => a.Type).ToArray(); }
public CustomMethodEmitter(CustomClassEmitter declaringType, string name, MethodAttributes attributes, Type returnType, Type[] parameterTypes) { ArgumentUtility.CheckNotNull("declaringType", declaringType); ArgumentUtility.CheckNotNullOrEmpty("name", name); ArgumentUtility.CheckNotNull("attributes", attributes); ArgumentUtility.CheckNotNull("returnType", returnType); ArgumentUtility.CheckNotNull("parameterTypes", parameterTypes); MethodEmitter innerEmitter = declaringType.InnerEmitter.CreateMethod(name, attributes, returnType, parameterTypes); _innerEmitter = innerEmitter; _declaringType = declaringType; _name = name; _parameterTypes = parameterTypes; }
public CustomPropertyEmitter(CustomClassEmitter declaringType, string name, PropertyKind propertyKind, Type propertyType, Type[] indexParameters, PropertyAttributes attributes) { ArgumentUtility.CheckNotNull("declaringType", declaringType); ArgumentUtility.CheckNotNullOrEmpty("name", name); ArgumentUtility.CheckNotNull("propertyType", propertyType); ArgumentUtility.CheckNotNull("indexParameters", indexParameters); _declaringType = declaringType; _name = name; _propertyKind = propertyKind; _propertyType = propertyType; _indexParameters = indexParameters; CallingConventions callingConvention = propertyKind == PropertyKind.Instance ? CallingConventions.HasThis : CallingConventions.Standard; _propertyBuilder = _declaringType.TypeBuilder.DefineProperty( name, attributes, callingConvention, propertyType, null, null, indexParameters, null, null); }