ConstructorBuilder.DefineParameter(Int32, ParameterAttributes, String) Method

Definition

Defines a parameter of this constructor.

C#
public System.Reflection.Emit.ParameterBuilder DefineParameter(int iSequence, System.Reflection.ParameterAttributes attributes, string? strParamName);
C#
public System.Reflection.Emit.ParameterBuilder DefineParameter(int iSequence, System.Reflection.ParameterAttributes attributes, string strParamName);

Parameters

iSequence
Int32

The position of the parameter in the parameter list. Parameters are indexed beginning with the number 1 for the first parameter.

attributes
ParameterAttributes

The attributes of the parameter.

strParamName
String

The name of the parameter. The name can be the null string.

Returns

An object that represents the new parameter of this constructor.

Exceptions

iSequence is less than 0 (zero), or it is greater than the number of parameters of the constructor.

The containing type has been created using CreateType().

Remarks

If you specify 0 (zero) for iSequence, this method returns a ParameterBuilder instead of throwing an exception. There is nothing useful that you can do with this ParameterBuilder.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided), 2.1