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); } }
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); } } }