DefaultParameterValueAttribute Constructor (Object^)

 

Initializes a new instance of the DefaultParameterValueAttribute class with the default value of a parameter.

Namespace:   System.Runtime.InteropServices
Assembly:  System (in System.dll)

public:
DefaultParameterValueAttribute(
	Object^ value
)

Parameters

value
Type: System::Object^

An object that represents the default value of a parameter.

Use this constructor to apply the DefaultParameterValueAttribute attribute to a parameter written in a language such as Microsoft Visual C# that does not support default parameters.

The following code example demonstrates how to apply the DefaultParameterValueAttribute attribute to a parameter of a method written in C#.

static public void MethodWithDefaultParam([System.Runtime.InteropServices.DefaultParameterValue("DEFAULT_PARAM_VALUE")] string var)
{
	Console.WriteLine("The passed value is: " + var);
}

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Return to top
Show: