System.Reflection.Emit.ParameterBuilder Class

Assembly: Mscorlib.dll
Namespace: System.Reflection.Emit
Summary
Creates or associates parameter information.
C# Syntax:
public class ParameterBuilder
Thread Safety
Reflection Emit is thread-safe when using assemblies that were created with the AppDomain.DefineDynamicAssembly method with the Boolean parameter isSynchronized set to true.
Remarks
Parameter attributes need to consistent with the method signature. If you specify Out attributes for a parameter, you should ensure that the type of that method parameter is a ByRef type. Some ParameterBuilder attributes require that you call TypeBuilder.DefineMethod with viable parameters in order for the Microsoft intermediate language (MSIL) to work correctly at runtime. For example, if you define a ParameterBuilder with ParameterAttributes.Out for parameter 1 of a MethodBuilder, then parameter 1 of MethodBuilder must be a reference such as Type.GetType("System.String&"), rather than Type.GetType("System.String").
See also:
System.Reflection.Emit Namespace

System.Reflection.Emit.ParameterBuilder Member List:

Public Properties
Attributes Read-only

Retrieves the attributes for this parameter.
IsIn Read-only

Retrieves whether this is an input parameter.
IsOptional Read-only

Retrieves whether this parameter is optional.
IsOut Read-only

Retrieves whether this parameter is an output parameter.
Name Read-only

Retrieves the name of this parameter.
Position Read-only

Retrieves the signature position for this parameter.
Public Methods
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetToken Retrieves the token for this parameter.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
SetConstant Sets the default value of the parameter.
SetCustomAttribute Overloaded:
SetCustomAttribute(CustomAttributeBuilder customBuilder)

Set a custom attribute using a custom attribute builder.
SetCustomAttribute Overloaded:
SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)

Set a custom attribute using a specified custom attribute blob.
SetMarshal Specifies the marshaling for this parameter.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Reflection.Emit.ParameterBuilder Member Details

Property: Attributes (read-only)
Summary
Retrieves the attributes for this parameter.
C# Syntax:
public virtual int Attributes {get;}
Remarks
The values of the attribute correspond to the values of the ParameterAttributes enumeration.

Return to top


Property: IsIn (read-only)
Summary
Retrieves whether this is an input parameter.
C# Syntax:
public bool IsIn {get;}
Remarks
This method depends on an optional metadata flag. This flag can be inserted by compilers, but the compilers are not obligated to do so.

Return to top


Property: IsOptional (read-only)
Summary
Retrieves whether this parameter is optional.
C# Syntax:
public bool IsOptional {get;}

Return to top


Property: IsOut (read-only)
Summary
Retrieves whether this parameter is an output parameter.
C# Syntax:
public bool IsOut {get;}

Return to top


Property: Name (read-only)
Summary
Retrieves the name of this parameter.
C# Syntax:
public virtual string Name {get;}

Return to top


Property: Position (read-only)
Summary
Retrieves the signature position for this parameter.
C# Syntax:
public virtual int Position {get;}

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~ParameterBuilder();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetToken()
Summary
Retrieves the token for this parameter.
C# Syntax:
public virtual ParameterToken GetToken();
Return Value:
Returns the token for this parameter.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: SetConstant(
   object defaultValue
)
Summary
Sets the default value of the parameter.
C# Syntax:
public virtual void SetConstant(
   object defaultValue
);
Parameters:

defaultValue

The default value of this parameter.

Exceptions
Exception Type Condition
ArgumentException The type of defaultValue is not one of the types mentioned in the remarks section.
Remarks
defaultValue is restricted to the following types: Boolean, SByte, Int16, Int32, Int64, Byte, UInt16, UInt32, UInt64, Single, Double, DateTime, Char, String, and Enum. If the type of the parameter is Decimal or Object, defaultValue can only be null.

Return to top


Overloaded Method: SetCustomAttribute(
   CustomAttributeBuilder customBuilder
)
Summary
Set a custom attribute using a custom attribute builder.
C# Syntax:
public void SetCustomAttribute(
   CustomAttributeBuilder customBuilder
);
Parameters:

customBuilder

An instance of a helper class to define the custom attribute.

Exceptions
Exception Type Condition
ArgumentNullException con is null.

Return to top


Overloaded Method: SetCustomAttribute(
   ConstructorInfo con,
   byte[] binaryAttribute
)
Summary
Set a custom attribute using a specified custom attribute blob.
C# Syntax:
public void SetCustomAttribute(
   ConstructorInfo con,
   byte[] binaryAttribute
);
Parameters:

con

The constructor for the custom attribute.

binaryAttribute

A byte blob representing the attributes.

Exceptions
Exception Type Condition
ArgumentNullException con or binaryAttribute is null.
Remarks
See the metadata specifications in the Tool Developers Guide for details on how to format binaryAttribute.

Return to top


Method: SetMarshal(
   UnmanagedMarshal unmanagedMarshal
)
Summary
Specifies the marshaling for this parameter.
C# Syntax:
public virtual void SetMarshal(
   UnmanagedMarshal unmanagedMarshal
);
Parameters:

unmanagedMarshal

The marshaling information for this parameter.

Exceptions
Exception Type Condition
ArgumentNullException unmanagedMarshal is null.
Remarks
This method should throw the following exception but currently does not:

InvalidOperationException if the containing type has been created using TypeBuilder.CreateType().

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.