Поделиться через


ConstructorBuilder.DefineParameter Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Defines the name and attributes of a parameter of this constructor.

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

Syntax

'Declaration
Public Function DefineParameter ( _
    iSequence As Integer, _
    attributes As ParameterAttributes, _
    strParamName As String _
) As ParameterBuilder
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.
  • strParamName
    Type: System.String
    The name of the parameter. The name can be a null string.

Return Value

Type: System.Reflection.Emit.ParameterBuilder
An object that represents the parameter.

Exceptions

Exception Condition
ArgumentOutOfRangeException

iSequence is less than or equal to zero, or it is greater than the number of parameters of the constructor.

InvalidOperationException

The containing type has been created using CreateType.

Remarks

You can use the ParameterInfo that is returned by this method to add custom attributes to the parameter.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.