You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

28 line
731 B

  1. using System;
  2. using System.Collections.Generic;
  3. namespace SUISS.Storage
  4. {
  5. public class StorableDictionary<GenericValue> : Dictionary<string, GenericValue>, IStorable
  6. {
  7. public void FromStorage(IDictionary<string, object> dict)
  8. {
  9. base.Clear();
  10. foreach (KeyValuePair<string, object> keyValuePair in dict)
  11. {
  12. base.Add(keyValuePair.Key, (GenericValue)((object)keyValuePair.Value));
  13. }
  14. }
  15. public IDictionary<string, object> ToStorage()
  16. {
  17. Dictionary<string, object> dictionary = new Dictionary<string, object>();
  18. foreach (KeyValuePair<string, GenericValue> keyValuePair in this)
  19. {
  20. dictionary.Add(keyValuePair.Key, keyValuePair.Value);
  21. }
  22. return dictionary;
  23. }
  24. }
  25. }