MethodBuilder.DefineParameter Method

Defines a parameter of this method.

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

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 parameter of this method.

Exception typeCondition


The method has no parameters.


position is less than or equal to zero.


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


The containing type was previously created using CreateType.


For the current method, the IsGenericMethod property is true, but the IsGenericMethodDefinition property is false.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions