AppDomain.IsCompatibilitySwitchSet Method (String)

 

Gets a nullable Boolean value that indicates whether any compatibility switches are set, and if so, whether the specified compatibility switch is set.

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

Public Function IsCompatibilitySwitchSet (
	value As String
) As Nullable(Of Boolean)

Parameters

value
Type: System.String

The compatibility switch to test.

Return Value

Type: System.Nullable(Of Boolean)

A null reference (Nothing in Visual Basic) if no compatibility switches are set; otherwise, a Boolean value that indicates whether the compatibility switch that is specified by value is set.

This method tests whether the specified compatibility switch has been set for the current application domain. Compatibility switches typically restore a behavior (such as the way strings are sorted) that was changed between versions of the .NET Framework. They are set by calling the AppDomainSetup.SetCompatibilitySwitches method before creating an application domain.

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

Switch

Meaning

"NetFx40_LegacySecurityPolicy"

Code access security (CAS) for the .NET Framework 3.5 is enabled in this application domain. See <NetFx40_LegacySecurityPolicy> Element.

"NetFx40_Legacy20SortingBehavior"

String sorting defaults for the .NET Framework 3.5 are enabled in this application domain. Its success requires sort00001000.dll to be installed. See <CompatSortNLSVersion> Element.

"NetFx40_Legacy40SortingBehavior"

String sorting defaults for the .NET Framework 4and Unicode 5.0 are enabled in this application domain. Its success requires sort00060101.dll to be installed.

"NetFx40_TimeSpanLegacyFormatMode"

TimeSpan formatting behavior for the .NET Framework 3.5 is enabled in this application domain. See <TimeSpan_LegacyFormatMode> Element and the "Restoring Legacy TimeSpan Formatting" section of the TimeSpan topic.

"UseRandomizedStringHashAlgorithm"

The runtime calculates hash codes for strings on a per application domain basis instead of using a single hashing algorithm that produces a consistent hash code across application domains. See <UseRandomizedStringHashAlgorithm> Element.

.NET Framework
Available since 4.0
Silverlight
Available since 4.0
Return to top
Show: