Value Property

Switch.Value Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets the value of the switch.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

protected string Value { get; set; }
/** @property */
protected String get_Value ()

/** @property */
protected void set_Value (String value)

protected function get Value () : String

protected function set Value (value : String)

Property Value

A string representing the value of the switch.

Exception typeCondition


The value is a null reference (Nothing in Visual Basic).


The value does not consist solely of an optional negative sign followed by a sequence of digits ranging from 0 to 9.


The value represents a number less than MinValue or greater than MaxValue.

The OnValueChanged method is called when the value of the Value property is changed. The OnValueChanged method parses the value of this property and converts it to an integer value, which is then used to set the SwitchSetting property.

Notes to Inheritors You should override the OnValueChanged method and provide a conversion operation that sets the appropriate SwitchSetting value for your switch.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

© 2016 Microsoft