4 using System.Collections;
5 using System.Collections.Generic;
6 using System.Collections.Specialized;
8 using SiliconStudio.Core.Serialization.Serializers;
10 namespace SiliconStudio.Core.Collections
23 private Dictionary<TKey, TValue> innerDictionary;
31 innerDictionary =
new Dictionary<TKey, TValue>();
35 public void Add(TKey key, TValue value)
37 innerDictionary.Add(key, value);
38 var collectionChanged = CollectionChanged;
39 if (collectionChanged != null)
46 return innerDictionary.ContainsKey(key);
58 var collectionChanged = CollectionChanged;
59 if (collectionChanged != null && innerDictionary.ContainsKey(key))
62 return innerDictionary.Remove(key);
68 return innerDictionary.TryGetValue(key, out value);
74 get {
return innerDictionary.Values; }
78 public TValue
this[TKey key]
82 return innerDictionary[key];
86 var collectionChanged = CollectionChanged;
87 if (collectionChanged != null)
90 bool alreadyExisting = innerDictionary.TryGetValue(key, out oldValue);
93 innerDictionary[key] = value;
98 innerDictionary[key] = value;
104 public void Add(KeyValuePair<TKey, TValue> item)
106 Add(item.Key, item.Value);
112 var collectionChanged = CollectionChanged;
113 if (collectionChanged != null)
115 foreach (var key
in innerDictionary.Keys.ToArray())
122 innerDictionary.Clear();
127 public bool Contains(KeyValuePair<TKey, TValue> item)
129 return innerDictionary.Contains(item);
133 public void CopyTo(KeyValuePair<TKey, TValue>[] array,
int arrayIndex)
141 get {
return innerDictionary.Count; }
145 public bool IsReadOnly
151 public bool Remove(KeyValuePair<TKey, TValue> item)
153 var collectionChanged = CollectionChanged;
154 if (collectionChanged != null && innerDictionary.Contains(item))
155 return innerDictionary.Remove(item.Key);
163 return innerDictionary.GetEnumerator();
167 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
169 return innerDictionary.GetEnumerator();
173 void IDictionary.Add(
object key,
object value)
179 bool IDictionary.Contains(
object key)
181 return ((
IDictionary)innerDictionary).Contains(key);
185 IDictionaryEnumerator IDictionary.GetEnumerator()
187 return ((
IDictionary)innerDictionary).GetEnumerator();
191 bool IDictionary.IsFixedSize
193 get {
return ((
IDictionary)innerDictionary).IsFixedSize; }
203 void IDictionary.Remove(
object key)
211 get {
return ((
IDictionary)innerDictionary).Values; }
215 object IDictionary.this[
object key]
217 get {
return ((
IDictionary)innerDictionary)[key]; }
218 set { ((
IDictionary)innerDictionary)[key] = value; }
222 void ICollection.CopyTo(
Array array,
int index)
224 ((
IDictionary)innerDictionary).CopyTo(array, index);
228 bool ICollection.IsSynchronized
230 get {
return ((
IDictionary)innerDictionary).IsSynchronized; }
234 object ICollection.SyncRoot
236 get {
return ((
IDictionary)innerDictionary).SyncRoot; }
TrackingDictionary()
Initializes a new instance of the TrackingDictionary{TKey, TValue} class.
void CopyTo(KeyValuePair< TKey, TValue >[] array, int arrayIndex)
DataSerializerGenericMode
Defines what generic parameters to pass to the serializer.
bool Contains(KeyValuePair< TKey, TValue > item)
IEnumerator< KeyValuePair< TKey, TValue > > GetEnumerator()
void Add(TKey key, TValue value)
void Add(KeyValuePair< TKey, TValue > item)
SiliconStudio.Paradox.Input.Keys Keys
bool ContainsKey(TKey key)
bool TryGetValue(TKey key, out TValue value)
EventHandler< TrackingCollectionChangedEventArgs > CollectionChanged
bool Remove(KeyValuePair< TKey, TValue > item)