예제 #1
0
        public bool RemoveData <T>(string key) where T : class
        {
            if (SettingsBrokerInstances.All(s => s.Key != key))
            {
                throw new NotSupportedException("Item does not exists");
            }

            return(SettingsBrokerInstances.Remove(SettingsBrokerInstances.FirstOrDefault(s => s.Key == key)));
        }
예제 #2
0
        public T GetData <T>(string key) where T : class
        {
            if (SettingsBrokerInstances.All(s => s.Key != key))
            {
                return(default(T));
            }

            return(SettingsBrokerInstances.FirstOrDefault(s => key == s.Key).Value as T);
        }