다음을 통해 공유


ParameterInfo.DefaultValue Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Overridable ReadOnly Property DefaultValue As Object
public virtual Object DefaultValue { get; }

Property Value

Type: System.Object
The default value of the parameter, or Value if the parameter has no default value.

Remarks

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 nulla null reference (Nothing in Visual Basic). This is distinct from the case where a default value is not defined.

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

Platform Notes

Silverlight for Windows Phone Silverlight for Windows Phone

 DefaultValue returns null in Silverlight for Windows Phone.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.