編集

次の方法で共有


AppDomain.IsCompatibilitySwitchSet(String) Method

Definition

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

public:
 Nullable<bool> IsCompatibilitySwitchSet(System::String ^ value);
public bool? IsCompatibilitySwitchSet (string value);
member this.IsCompatibilitySwitchSet : string -> Nullable<bool>
Public Function IsCompatibilitySwitchSet (value As String) As Nullable(Of Boolean)

Parameters

value
String

The compatibility switch to test.

Returns

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.

Remarks

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.

Applies to

See also