value
element is a name/value pair that consists of the name of a switch and its Boolean value. By default, the switch is always implicitly false
, which provides the new behavior (and makes the new behavior opt-in by default). Setting the switch to true
enables it, which provides the legacy behavior. Explicitly setting the switch to false
also provides the new behavior.true
if the switchName
argument is found, and when the method returns, its isEnabled
argument indicates the value of the switch. Otherwise, the method returns false
.StringLibrary
. It defines a SubstringStartsAt
method that performs an ordinal comparison to determine the starting index of a substring within a larger string.SubstringStartsAt
method to use culture-sensitive comparison.StringLibrary.DoNotUseCultureSensitiveComparison
. Its default value, false
, indicates that the library should perform its version 2.0 culture-sensitive comparison. true
indicates that the library should perform its version 1.0 ordinal comparison. A slight modification of the previous code allows the library consumer to set the switch to determine the kind of comparison the method performs.false
, which is typically the default value, the new behavior is enabled; if it is true
, the new behavior is disabled, and the member behaves as it did previously.switchName
argument defines the switch name, and the isEnabled
property defines the value of the switch. Because AppContext is a static class, it is available on a per-application domain basis.<AppContextSwitchOverrides>
element to the <runtime> section of your app.config file. The switch has a single attribute, value
, whose value is a string that represents a key/value pair containing both the switch name and its value.value
attribute with a semicolon. In that case, the <AppContextSwitchOverrides>
element has the following format:<AppContextSwitchOverrides>
element to define a configuration setting has application scope; that is, it affects only the application.True
, true
, False
, or false
. If the runtime encounters any other value, it ignores the switch.file://
is no longer a valid part of a file path.Switch.System.IO.UseLegacyPathHandling
switch to the application configuration file for the example: Photosweeper 3 2 4.BaseDirectory | Gets the file path of the base directory that the assembly resolver uses to probe for assemblies. |
TargetFrameworkName | Gets the name of the framework version targeted by the current application. |
GetData(String) | Returns the value of the named data element assigned to the current application domain. |
SetSwitch(String, Boolean) | Sets the value of a switch. |
TryGetSwitch(String, Boolean) | Tries to get the value of a switch. |