예제 #1
0
 public void Add(string key, object value)
 {
     if (ContainsKey(key))
     {
         throw new ArgumentException("An item with the same key has already been added.");
     }
     if (value != null)
     {
         ApplicationDataContainerInterop.SetValue(_locality, key, DataTypeSerializer.Serialize(value));
         MapChanged?.Invoke(this, null);
     }
 }
예제 #2
0
 public object?this[string key]
 {
     get
     {
         if (ApplicationDataContainerInterop.TryGetValue(_locality, key, out var value))
         {
             return(DataTypeSerializer.Deserialize(value));
         }
         return(null);
     }
     set
     {
         if (value != null)
         {
             ApplicationDataContainerInterop.SetValue(_locality, key, DataTypeSerializer.Serialize(value));
         }
         else
         {
             Remove(key);
         }
     }
 }