Share via


AppDomainSetup.SetCompatibilitySwitches Method

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

Sets the specified switches, making the application domain compatible with previous versions of the .NET Framework for Silverlight for the specified issues.

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

Syntax

'Declaration
Public Sub SetCompatibilitySwitches ( _
    switches As IEnumerable(Of String) _
)
public void SetCompatibilitySwitches(
    IEnumerable<string> switches
)

Parameters

  • switches
    Type: System.Collections.Generic.IEnumerable<String>
    An enumerable set of string values that specify compatibility switches, or nulla null reference (Nothing in Visual Basic) to erase the existing compatibility switches.

Remarks

Major versions of the .NET Framework sometimes introduce breaking changes from the previous version. For example, Silverlight 4 introduces a small number of breaking changes from Silverlight 3. Use the SetCompatibilitySwitches method to specify that one or more of these breaking changes should be rolled back for the application domain, to make the behavior compatible with the previous version.

Each time you call this method, it replaces the existing switch settings. To erase the settings, specify nulla null reference (Nothing in Visual Basic) for the switches parameter.

The set of string values you provide for switches can be a simple string array, because arrays implement the IEnumerable interface.

The following table provides examples of compatibility switches that can be set to restore the behavior of earlier versions.

Switch

Meaning

"APP_EARLIER_THAN_SL4.0"

Restores the behavior of selected Char and String methods that use ordinal string comparison and case conversion with the invariant culture in Silverlight 2 and Silverlight 3.

Version Information

Silverlight

Supported in: 5, 4

Platforms

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