Bewerken

Share via


ParameterInfo.DefaultValue Property

Definition

Gets a value indicating the default value if the parameter has a default value.

public:
 virtual property System::Object ^ DefaultValue { System::Object ^ get(); };
public virtual object DefaultValue { get; }
public virtual object? DefaultValue { get; }
member this.DefaultValue : obj
Public Overridable ReadOnly Property DefaultValue As Object

Property Value

The default value of the parameter, or Value if the parameter has no default value.

Remarks

This property is used only in the execution context. In the reflection-only context, use the RawDefaultValue property instead.

The default value is used when an actual value is not specified in the method call. A parameter can have a default value that is null. This is distinct from the case where a default value is not defined.

This method utilizes the DefaultValueImpl method.

To get the ParameterInfo array, first get the method or the constructor and then call MethodBase.GetParameters.

Applies to