System.LocalAppContext.GetCachedSwitchValue C# (CSharp) Method

GetCachedSwitchValue() private method

private GetCachedSwitchValue ( string switchName, int &switchValue ) : bool
switchName string
switchValue int
return bool
        internal static bool GetCachedSwitchValue(string switchName, ref int switchValue)
        {
            if (switchValue < 0) return false;
            if (switchValue > 0) return true;

            return GetCachedSwitchValueInternal(switchName, ref switchValue);
        }

Usage Example

Esempio n. 1
0
        internal static void ValidateLevels()
        {
            if (levelsValidated)
            {
                return;
            }

            bool level1 = !LocalAppContext.GetCachedSwitchValue(UseLegacyAccessibilityFeaturesSwitchName, ref useLegacyAccessibilityFeatures);
            bool level2 = !LocalAppContext.GetCachedSwitchValue(UseLegacyAccessibilityFeatures2SwitchName, ref useLegacyAccessibilityFeatures2);

            // 4.7.2 accessibility improvements are building upon the infrastructure introduced in 4.7.1,
            // thus the application has to opt-in into 4.7.1 level in order to get the 4.7.2 level of support.
            if (!level1 && level2)
            {
                throw new NotSupportedException(SR.GetString(SR.CombinationOfAccessibilitySwitchesNotSupported));
            }

            // If this code is executed concurrently, in the worst case we'll throw the same exception on each thread.
            levelsValidated = true;
        }
All Usage Examples Of System.LocalAppContext::GetCachedSwitchValue