MethodBuilder.DefineParameter Method
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
Not applicable.
Parameters
- position
The position of the parameter in the parameter list. Parameters are indexed beginning with the number 1 for the first parameter; the number 0 represents the return value of the method.
- attributes
The parameter attributes of the parameter.
- strParamName
The name of the parameter. The name can be the null string.
Return Value
Returns a ParameterBuilder object that represents a parameter of this method or the return value of this method.| Exception type | Condition |
|---|---|
| The method has no parameters. -or- position is less than zero. -or- position is greater than the number of the method's parameters. | |
| The containing type was previously created using CreateType. -or- For the current method, the IsGenericMethod property is true, but the IsGenericMethodDefinition property is false. |
The ParameterBuilder object returned by this method can be used to set the default value for a parameter or to apply custom attributes.
Parameter numbering begins with 1, so position is 1 for the first parameter. If position is zero, this method affects the return value.
Note: |
|---|
| In the .NET Framework versions 1.0 and 1.1, an exception is thrown if position is zero, so this method cannot be used to modify attributes of the return value in those versions. |
Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Note: