DefineParameter Method

ConstructorBuilder.DefineParameter Method (Int32, ParameterAttributes, String)

 

Defines a parameter of this constructor.

Namespace:   System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public ParameterBuilder DefineParameter(
	int iSequence,
	ParameterAttributes attributes,
	string strParamName
)

Parameters

iSequence
Type: System.Int32

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

attributes
Type: System.Reflection.ParameterAttributes

The attributes of the parameter.

strParamName
Type: System.String

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

Return Value

Type: System.Reflection.Emit.ParameterBuilder

Returns a ParameterBuilder object that represents the new parameter of this constructor.

Exception Condition
ArgumentOutOfRangeException

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

InvalidOperationException

The containing type has been created using CreateType.

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.

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Return to top
Show:
© 2016 Microsoft