public static List <SettingsContextBase> GetCurrentContexts()
        {
            List <SettingsContextBase> list = new List <SettingsContextBase>();

            for (SettingsContextBase.NestedContext nestedContext = SettingsContextBase.NestedContext.Current; nestedContext != null; nestedContext = nestedContext.ParentContext)
            {
                if (nestedContext.Context != null)
                {
                    list.Insert(0, nestedContext.Context);
                }
            }
            return(list);
        }
            private static T ComputeInheritedValue <T>(Func <SettingsContextBase, T> valueGetter)
            {
                for (SettingsContextBase.NestedContext nestedContext = SettingsContextBase.NestedContext.Current; nestedContext != null; nestedContext = nestedContext.ParentContext)
                {
                    T t = SettingsContextBase.EffectiveContextObject.ComputeChainedValue <T>(nestedContext.Context, valueGetter);
                    if (t != null && !t.Equals(default(T)))
                    {
                        return(t);
                    }
                }
                ISettingsContext settingsContext = (SettingsContextBase.DefaultContextGetter != null) ? SettingsContextBase.DefaultContextGetter() : null;

                return(SettingsContextBase.EffectiveContextObject.ComputeChainedValue <T>(settingsContext as SettingsContextBase, valueGetter));
            }