AddTypeParameter(string)
Adds a generic parameter to the method.
Declaration
ITypeParameterBuilder AddTypeParameter(string name)Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the generic type parameter to add. |
Returns
| Type | Description |
|---|---|
| ITypeParameterBuilder | An ITypeParameterBuilder that allows you to further configure the new type parameter, including constraints and variance. |
AddTypeParameter(ITypeParameter, bool)
Adds a type parameter that copies an existing type parameter: its name, its variance, its kind constraints and its type constraints.
Declaration
ITypeParameterBuilder AddTypeParameter(ITypeParameter prototype, bool includeCustomAttributes = false)Parameters
| Type | Name | Description |
|---|---|---|
| ITypeParameter | prototype | The type parameter to copy, typically a type parameter of another method or type. |
| bool | includeCustomAttributes | A value indicating whether the custom attributes of |
Returns
| Type | Description |
|---|---|
| ITypeParameterBuilder | An ITypeParameterBuilder that allows you to change the copy. |
Remarks
The builder records the copy. In the type constraints of the copy, and in the types of the type parameters and parameters that are
copied afterwards, a reference to prototype is replaced by a reference to the copy. Copy the type parameters
before the parameters that use them.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | A type parameter of the same name already exists. |