SetTypeArgument(ITypeParameter, IType)
Sets the type argument that the call site passes to a type parameter that the delegate added to the Method method builder.
Declaration
void SetTypeArgument(ITypeParameter typeParameter, IType typeArgument)Parameters
| Type | Name | Description |
|---|---|---|
| ITypeParameter | typeParameter | A type parameter that the delegate added to the Method method builder. |
| IType | typeArgument | The type argument at this call site, for instance the type of an argument given by the Context property. |
Remarks
The derived type parameters of the interceptor method, which come from the intercepted method or from the calling type, are locked, and the engine passes their type arguments. The delegate can add type parameters after them, for instance to make a parameter generic so that the call sites whose arguments have different types share one interceptor method. Each added type parameter must receive a type argument with this method. Otherwise, the site is not intercepted and LAMA1014 is reported.
The type arguments are not part of the key that deduplicates the interceptor methods, but the type parameters are. Two call sites whose
builders differ only by the type arguments therefore share one method. The template reads an added type parameter through the
meta.Target.Method.TypeParameters property. The SetArgument(IParameter, IExpression) method does the same for the
value of an added parameter.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|