public CILEvent ChangeDeclaringType(params CILTypeBase[] args) { LogicalUtils.ThrowIfDeclaringTypeNotGeneric(this, args); CILEvent evtToGive = this; CILType dt = this.declaringType.Value; if (dt.GenericDefinition != null) { evtToGive = dt.GenericDefinition.DeclaredEvents[dt.DeclaredEvents.IndexOf(this)]; } return(this.context.Cache.MakeEventWithGenericType(evtToGive, args)); }
public CILMethodBase ChangeDeclaringTypeUT(params CILTypeBase[] args) { // TODO return this if decl type has no gArgs and args is empty. LogicalUtils.ThrowIfDeclaringTypeNotGeneric(this, args); var gDef = this.declaringType.Value.GenericDefinition; var thisMethod = this.ThisOrGDef(); return(this.MakeGenericIfNeeded(this.context.Cache.MakeMethodWithGenericDeclaringType( gDef == null ? this : (API.MethodKind.Method == this.methodKind ? (CILMethodBase)gDef.DeclaredMethods[this.declaringType.Value.DeclaredMethods.IndexOf((CILMethod)thisMethod)] : gDef.Constructors[this.declaringType.Value.Constructors.IndexOf((CILConstructor)thisMethod)]), args ))); }
public CILProperty ChangeDeclaringType(params CILTypeBase[] args) { LogicalUtils.ThrowIfDeclaringTypeNotGeneric(this, args); CILProperty propToGive = this; CILType dt = this.declaringType.Value; if (dt.GenericDefinition != null) { propToGive = dt.GenericDefinition.DeclaredProperties[dt.DeclaredProperties.IndexOf(this)]; } return(this.context.Cache.MakePropertyWithGenericType(propToGive, args)); }
public CILField ChangeDeclaringType(params CILTypeBase[] args) { LogicalUtils.ThrowIfDeclaringTypeNotGeneric(this, args); CILField fieldToGive = this; CILType dt = this.declaringType.Value; if (dt.GenericDefinition != null) { fieldToGive = dt.GenericDefinition.DeclaredFields[dt.DeclaredFields.IndexOf(this)]; } return(this.context.Cache.MakeFieldWithGenericDeclaringType(fieldToGive, args)); }