This documentation is archived and is not being maintained.

MethodBuilder.DefineParameter Method

Defines a parameter of this method.

[Visual Basic]
Public Function DefineParameter( _
   ByVal position As Integer, _
   ByVal attributes As ParameterAttributes, _
   ByVal strParamName As String _
) As ParameterBuilder
public ParameterBuilder DefineParameter(
 int position,
 ParameterAttributes attributes,
 string strParamName
public: ParameterBuilder* DefineParameter(
 int position,
 ParameterAttributes attributes,
 String* strParamName
public function DefineParameter(
   position : int,
 attributes : ParameterAttributes,
 strParamName : String
) : ParameterBuilder;


The position of the parameter in the parameter list. Parameters are indexed beginning with the number 1 for the first parameter.
The attributes of the parameter.
The name of the parameter. The name can be the null string.

Return Value

Returns a ParameterBuilder object that represents the new parrameter of this method.


Exception Type Condition
ArgumentOutOfRangeException The method has no parameters.


position is less than or equal to zero.


position is greater than the number of the method's parameters.

InvalidOperationException The containing type was previously created using CreateType


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

MethodBuilder Class | MethodBuilder Members | System.Reflection.Emit Namespace