Open sandboxFocus

Method AddParameter

AddParameter(string, IType, RefKind, TypedConstant?)

Adds a parameter to the current indexer and specifies its type using an IType.

Declaration
IParameterBuilder AddParameter(string name, IType type, RefKind refKind = RefKind.None, TypedConstant? defaultValue = null)
Parameters
Type Name Description
string name

The name of the parameter.

IType type

The type of the parameter.

RefKind refKind

The ref kind of the parameter (e.g., ref, out, in).

TypedConstant? defaultValue

The default value of the parameter, or null if the parameter has no default value.

Returns
Type Description
IParameterBuilder

An IParameterBuilder that allows further configuration of the new parameter.

AddParameter(string, Type, RefKind, TypedConstant?)

Adds a parameter to the current indexer and specifies its type using a reflection Type.

Declaration
IParameterBuilder AddParameter(string name, Type type, RefKind refKind = RefKind.None, TypedConstant? defaultValue = null)
Parameters
Type Name Description
string name

The name of the parameter.

Type type

The type of the parameter.

RefKind refKind

The ref kind of the parameter (e.g., ref, out, in).

TypedConstant? defaultValue

The default value of the parameter, or null if the parameter has no default value.

Returns
Type Description
IParameterBuilder

An IParameterBuilder that allows further configuration of the new parameter.

AddParameter(IParameter, bool, bool)

Appends a parameter that copies an existing parameter: its name, its type and its reference kind.

Declaration
IParameterBuilder AddParameter(IParameter prototype, bool includeCustomAttributes = false, bool includeDefaultValues = false)
Parameters
Type Name Description
IParameter prototype

The parameter to copy, typically a parameter of another method.

bool includeCustomAttributes

A value indicating whether the custom attributes of prototype are copied.

bool includeDefaultValues

A value indicating whether the default value and the params modifier of prototype are copied.

Returns
Type Description
IParameterBuilder

An IParameterBuilder that allows you to change the copy.

Remarks

In the type of the copy, a reference to a type parameter that was copied with AddTypeParameter(ITypeParameter, bool) is replaced by a reference to its copy. The this modifier is never copied.

Exceptions
Type Condition
ArgumentException

A parameter of the same name already exists.