System.Reflection.Emit.ParameterBuilder.SetConstant Method

Sets the default value of the parameter.

Syntax

public virtual void SetConstant (object defaultValue)

Parameters

defaultValue
The default value of this parameter.

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 parameter type is a reference type, CLS compliance requires defaultValue to be null. However, starting with the net_v40_long, defaultValue can be non-null for a reference type as long as the value can be assigned to that reference type. For example, an Int32 value can be assigned to a parameter of type object. This is not CLS-compliant, but it can be useful in interop scenarios.

Requirements

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0