System.LocalAppContext.GetCachedSwitchValueInternal C# (CSharp) Method

GetCachedSwitchValueInternal() private static method

private static GetCachedSwitchValueInternal ( string switchName, int &switchValue ) : bool
switchName string
switchValue int
return bool
        private static bool GetCachedSwitchValueInternal(string switchName, ref int switchValue)
        {
            bool isSwitchEnabled;
            AppContext.TryGetSwitch(switchName, out isSwitchEnabled);

            if (DisableCaching)
            {
                return isSwitchEnabled;
            }

            switchValue = isSwitchEnabled ? 1 /*true*/ : -1 /*false*/;
            return isSwitchEnabled;
        }

Usage Example

 internal static bool GetCachedSwitchValue(string switchName, ref int switchValue)
 {
     return(switchValue >= 0 && (switchValue > 0 || LocalAppContext.GetCachedSwitchValueInternal(switchName, ref switchValue)));
 }