gistlib
main.cspublic class StateManager { private static Dictionary<string, object> _stateDictionary = new Dictionary<string, object>(); public static void SetValue(string key, object value) { if (_stateDictionary.ContainsKey(key)) { _stateDictionary[key] = value; } else { _stateDictionary.Add(key, value); } } public static object GetValue(string key) { if (_stateDictionary.ContainsKey(key)) { return _stateDictionary[key]; } return null; } public static void RemoveValue(string key) { if (_stateDictionary.ContainsKey(key)) { _stateDictionary.Remove(key); } } public static void ClearState() { _stateDictionary.Clear(); } } 831 chars40 lines
public class StateManager { private static Dictionary<string, object> _stateDictionary = new Dictionary<string, object>(); public static void SetValue(string key, object value) { if (_stateDictionary.ContainsKey(key)) { _stateDictionary[key] = value; } else { _stateDictionary.Add(key, value); } } public static object GetValue(string key) { if (_stateDictionary.ContainsKey(key)) { return _stateDictionary[key]; } return null; } public static void RemoveValue(string key) { if (_stateDictionary.ContainsKey(key)) { _stateDictionary.Remove(key); } } public static void ClearState() { _stateDictionary.Clear(); } }
gistlibby LogSnag