using System; using System.Diagnostics; using System.Runtime.InteropServices; using System.Runtime.Serialization; namespace System.Collections.Generic { /// Represents a collection of keys and values. /// The type of the keys in the dictionary. /// The type of the values in the dictionary. /// 1 // Token: 0x020000FF RID: 255 [DebuggerTypeProxy(typeof(CollectionDebuggerView<, >))] [DebuggerDisplay("Count={Count}")] [ComVisible(false)] [Serializable] public class Dictionary : IEnumerable, ISerializable, ICollection, ICollection>, IEnumerable>, IDictionary, IDictionary, IDeserializationCallback { /// Initializes a new instance of the class that is empty, has the default initial capacity, and uses the default equality comparer for the key type. // Token: 0x06000C6F RID: 3183 RVA: 0x00038614 File Offset: 0x00036814 public Dictionary() { this.Init(10, null); } /// Initializes a new instance of the class that is empty, has the default initial capacity, and uses the specified . /// The implementation to use when comparing keys, or null to use the default for the type of the key. // Token: 0x06000C70 RID: 3184 RVA: 0x00038628 File Offset: 0x00036828 public Dictionary(IEqualityComparer comparer) { this.Init(10, comparer); } /// Initializes a new instance of the class that contains elements copied from the specified and uses the default equality comparer for the key type. /// The whose elements are copied to the new . /// /// is null. /// /// contains one or more duplicate keys. // Token: 0x06000C71 RID: 3185 RVA: 0x0003863C File Offset: 0x0003683C public Dictionary(IDictionary dictionary) : this(dictionary, null) { } /// Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type. /// The initial number of elements that the can contain. /// /// is less than 0. // Token: 0x06000C72 RID: 3186 RVA: 0x00038648 File Offset: 0x00036848 public Dictionary(int capacity) { this.Init(capacity, null); } /// Initializes a new instance of the class that contains elements copied from the specified and uses the specified . /// The whose elements are copied to the new . /// The implementation to use when comparing keys, or null to use the default for the type of the key. /// /// is null. /// /// contains one or more duplicate keys. // Token: 0x06000C73 RID: 3187 RVA: 0x00038658 File Offset: 0x00036858 public Dictionary(IDictionary dictionary, IEqualityComparer comparer) { if (dictionary == null) { throw new ArgumentNullException("dictionary"); } int num = dictionary.Count; this.Init(num, comparer); foreach (KeyValuePair keyValuePair in dictionary) { this.Add(keyValuePair.Key, keyValuePair.Value); } } /// Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the specified . /// The initial number of elements that the can contain. /// The implementation to use when comparing keys, or null to use the default for the type of the key. /// /// is less than 0. // Token: 0x06000C74 RID: 3188 RVA: 0x000386EC File Offset: 0x000368EC public Dictionary(int capacity, IEqualityComparer comparer) { this.Init(capacity, comparer); } /// Initializes a new instance of the class with serialized data. /// A object containing the information required to serialize the . /// A structure containing the source and destination of the serialized stream associated with the . // Token: 0x06000C75 RID: 3189 RVA: 0x000386FC File Offset: 0x000368FC protected Dictionary(SerializationInfo info, StreamingContext context) { this.serialization_info = info; } // Token: 0x170001C8 RID: 456 // (get) Token: 0x06000C76 RID: 3190 RVA: 0x0003870C File Offset: 0x0003690C ICollection IDictionary.Keys { get { return this.Keys; } } // Token: 0x170001C9 RID: 457 // (get) Token: 0x06000C77 RID: 3191 RVA: 0x00038714 File Offset: 0x00036914 ICollection IDictionary.Values { get { return this.Values; } } /// Gets an containing the keys of the . /// An containing the keys of the . // Token: 0x170001CA RID: 458 // (get) Token: 0x06000C78 RID: 3192 RVA: 0x0003871C File Offset: 0x0003691C ICollection IDictionary.Keys { get { return this.Keys; } } /// Gets an containing the values in the . /// An containing the values in the . // Token: 0x170001CB RID: 459 // (get) Token: 0x06000C79 RID: 3193 RVA: 0x00038724 File Offset: 0x00036924 ICollection IDictionary.Values { get { return this.Values; } } /// Gets a value indicating whether the has a fixed size. /// true if the has a fixed size; otherwise, false. In the default implementation of , this property always returns false. // Token: 0x170001CC RID: 460 // (get) Token: 0x06000C7A RID: 3194 RVA: 0x0003872C File Offset: 0x0003692C bool IDictionary.IsFixedSize { get { return false; } } /// Gets a value indicating whether the is read-only. /// true if the is read-only; otherwise, false. In the default implementation of , this property always returns false. // Token: 0x170001CD RID: 461 // (get) Token: 0x06000C7B RID: 3195 RVA: 0x00038730 File Offset: 0x00036930 bool IDictionary.IsReadOnly { get { return false; } } /// Gets or sets the value with the specified key. /// The value associated with the specified key, or null if is not in the dictionary or is of a type that is not assignable to the key type of the . /// The key of the value to get. /// /// is null. /// A value is being assigned, and is of a type that is not assignable to the key type of the .-or-A value is being assigned, and is of a type that is not assignable to the value type of the . // Token: 0x170001CE RID: 462 object IDictionary.this[object key] { get { if (key is TKey && this.ContainsKey((TKey)((object)key))) { return this[this.ToTKey(key)]; } return null; } set { this[this.ToTKey(key)] = this.ToTValue(value); } } /// Adds the specified key and value to the dictionary. /// The object to use as the key. /// The object to use as the value. /// /// is null. /// /// is of a type that is not assignable to the key type of the .-or- is of a type that is not assignable to , the type of values in the .-or-A value with the same key already exists in the . // Token: 0x06000C7E RID: 3198 RVA: 0x0003878C File Offset: 0x0003698C void IDictionary.Add(object key, object value) { this.Add(this.ToTKey(key), this.ToTValue(value)); } /// Determines whether the contains an element with the specified key. /// true if the contains an element with the specified key; otherwise, false. /// The key to locate in the . /// /// is null. // Token: 0x06000C7F RID: 3199 RVA: 0x000387A4 File Offset: 0x000369A4 bool IDictionary.Contains(object key) { if (key == null) { throw new ArgumentNullException("key"); } return key is TKey && this.ContainsKey((TKey)((object)key)); } /// Removes the element with the specified key from the . /// The key of the element to remove. /// /// is null. // Token: 0x06000C80 RID: 3200 RVA: 0x000387DC File Offset: 0x000369DC void IDictionary.Remove(object key) { if (key == null) { throw new ArgumentNullException("key"); } if (key is TKey) { this.Remove((TKey)((object)key)); } } /// Gets a value indicating whether access to the is synchronized (thread safe). /// true if access to the is synchronized (thread safe); otherwise, false. In the default implementation of , this property always returns false. // Token: 0x170001CF RID: 463 // (get) Token: 0x06000C81 RID: 3201 RVA: 0x00038808 File Offset: 0x00036A08 bool ICollection.IsSynchronized { get { return false; } } /// Gets an object that can be used to synchronize access to the . /// An object that can be used to synchronize access to the . // Token: 0x170001D0 RID: 464 // (get) Token: 0x06000C82 RID: 3202 RVA: 0x0003880C File Offset: 0x00036A0C object ICollection.SyncRoot { get { return this; } } // Token: 0x170001D1 RID: 465 // (get) Token: 0x06000C83 RID: 3203 RVA: 0x00038810 File Offset: 0x00036A10 bool ICollection>.IsReadOnly { get { return false; } } // Token: 0x06000C84 RID: 3204 RVA: 0x00038814 File Offset: 0x00036A14 void ICollection>.Add(KeyValuePair keyValuePair) { this.Add(keyValuePair.Key, keyValuePair.Value); } // Token: 0x06000C85 RID: 3205 RVA: 0x0003882C File Offset: 0x00036A2C bool ICollection>.Contains(KeyValuePair keyValuePair) { return this.ContainsKeyValuePair(keyValuePair); } // Token: 0x06000C86 RID: 3206 RVA: 0x00038838 File Offset: 0x00036A38 void ICollection>.CopyTo(KeyValuePair[] array, int index) { this.CopyTo(array, index); } // Token: 0x06000C87 RID: 3207 RVA: 0x00038844 File Offset: 0x00036A44 bool ICollection>.Remove(KeyValuePair keyValuePair) { return this.ContainsKeyValuePair(keyValuePair) && this.Remove(keyValuePair.Key); } /// Copies the elements of the to an array, starting at the specified array index. /// The one-dimensional array that is the destination of the elements copied from . The array must have zero-based indexing. /// The zero-based index in at which copying begins. /// /// is null. /// /// is less than 0. /// /// is multidimensional.-or- does not have zero-based indexing.-or-The number of elements in the source is greater than the available space from to the end of the destination .-or-The type of the source cannot be cast automatically to the type of the destination . // Token: 0x06000C88 RID: 3208 RVA: 0x00038864 File Offset: 0x00036A64 void ICollection.CopyTo(Array array, int index) { KeyValuePair[] array2 = array as KeyValuePair[]; if (array2 != null) { this.CopyTo(array2, index); return; } this.CopyToCheck(array, index); DictionaryEntry[] array3 = array as DictionaryEntry[]; if (array3 != null) { this.Do_CopyTo(array3, index, (TKey key, TValue value) => new DictionaryEntry(key, value)); return; } this.Do_ICollectionCopyTo>(array, index, new Dictionary.Transform>(Dictionary.make_pair)); } /// Returns an enumerator that iterates through the collection. /// An that can be used to iterate through the collection. // Token: 0x06000C89 RID: 3209 RVA: 0x000388D8 File Offset: 0x00036AD8 IEnumerator IEnumerable.GetEnumerator() { return new Dictionary.Enumerator(this); } // Token: 0x06000C8A RID: 3210 RVA: 0x000388E8 File Offset: 0x00036AE8 IEnumerator> IEnumerable>.GetEnumerator() { return new Dictionary.Enumerator(this); } /// Returns an for the . /// An for the . // Token: 0x06000C8B RID: 3211 RVA: 0x000388F8 File Offset: 0x00036AF8 IDictionaryEnumerator IDictionary.GetEnumerator() { return new Dictionary.ShimEnumerator(this); } /// Gets the number of key/value pairs contained in the . /// The number of key/value pairs contained in the . // Token: 0x170001D2 RID: 466 // (get) Token: 0x06000C8C RID: 3212 RVA: 0x00038900 File Offset: 0x00036B00 public int Count { get { return this.count; } } /// Gets or sets the value associated with the specified key. /// The value associated with the specified key. If the specified key is not found, a get operation throws a , and a set operation creates a new element with the specified key. /// The key of the value to get or set. /// /// is null. /// The property is retrieved and does not exist in the collection. // Token: 0x170001D3 RID: 467 public TValue this[TKey key] { get { if (key == null) { throw new ArgumentNullException("key"); } int num = this.hcp.GetHashCode(key) | int.MinValue; for (int num2 = this.table[(num & int.MaxValue) % this.table.Length] - 1; num2 != -1; num2 = this.linkSlots[num2].Next) { if (this.linkSlots[num2].HashCode == num && this.hcp.Equals(this.keySlots[num2], key)) { return this.valueSlots[num2]; } } throw new KeyNotFoundException(); } set { if (key == null) { throw new ArgumentNullException("key"); } int num = this.hcp.GetHashCode(key) | int.MinValue; int num2 = (num & int.MaxValue) % this.table.Length; int num3 = this.table[num2] - 1; int num4 = -1; if (num3 != -1) { while (this.linkSlots[num3].HashCode != num || !this.hcp.Equals(this.keySlots[num3], key)) { num4 = num3; num3 = this.linkSlots[num3].Next; if (num3 == -1) { break; } } } if (num3 == -1) { if (++this.count > this.threshold) { this.Resize(); num2 = (num & int.MaxValue) % this.table.Length; } num3 = this.emptySlot; if (num3 == -1) { num3 = this.touchedSlots++; } else { this.emptySlot = this.linkSlots[num3].Next; } this.linkSlots[num3].Next = this.table[num2] - 1; this.table[num2] = num3 + 1; this.linkSlots[num3].HashCode = num; this.keySlots[num3] = key; } else if (num4 != -1) { this.linkSlots[num4].Next = this.linkSlots[num3].Next; this.linkSlots[num3].Next = this.table[num2] - 1; this.table[num2] = num3 + 1; } this.valueSlots[num3] = value; this.generation++; } } // Token: 0x06000C8F RID: 3215 RVA: 0x00038B9C File Offset: 0x00036D9C private void Init(int capacity, IEqualityComparer hcp) { if (capacity < 0) { throw new ArgumentOutOfRangeException("capacity"); } this.hcp = ((hcp == null) ? EqualityComparer.Default : hcp); if (capacity == 0) { capacity = 10; } capacity = (int)((float)capacity / 0.9f) + 1; this.InitArrays(capacity); this.generation = 0; } // Token: 0x06000C90 RID: 3216 RVA: 0x00038BFC File Offset: 0x00036DFC private void InitArrays(int size) { this.table = new int[size]; this.linkSlots = new Link[size]; this.emptySlot = -1; this.keySlots = new TKey[size]; this.valueSlots = new TValue[size]; this.touchedSlots = 0; this.threshold = (int)((float)this.table.Length * 0.9f); if (this.threshold == 0 && this.table.Length > 0) { this.threshold = 1; } } // Token: 0x06000C91 RID: 3217 RVA: 0x00038C80 File Offset: 0x00036E80 private void CopyToCheck(Array array, int index) { if (array == null) { throw new ArgumentNullException("array"); } if (index < 0) { throw new ArgumentOutOfRangeException("index"); } if (index > array.Length) { throw new ArgumentException("index larger than largest valid index of array"); } if (array.Length - index < this.Count) { throw new ArgumentException("Destination array cannot hold the requested elements!"); } } // Token: 0x06000C92 RID: 3218 RVA: 0x00038CE8 File Offset: 0x00036EE8 private void Do_CopyTo(TElem[] array, int index, Dictionary.Transform transform) where TRet : TElem { for (int i = 0; i < this.touchedSlots; i++) { if ((this.linkSlots[i].HashCode & -2147483648) != 0) { array[index++] = (TElem)((object)transform(this.keySlots[i], this.valueSlots[i])); } } } // Token: 0x06000C93 RID: 3219 RVA: 0x00038D5C File Offset: 0x00036F5C private static KeyValuePair make_pair(TKey key, TValue value) { return new KeyValuePair(key, value); } // Token: 0x06000C94 RID: 3220 RVA: 0x00038D68 File Offset: 0x00036F68 private static TKey pick_key(TKey key, TValue value) { return key; } // Token: 0x06000C95 RID: 3221 RVA: 0x00038D6C File Offset: 0x00036F6C private static TValue pick_value(TKey key, TValue value) { return value; } // Token: 0x06000C96 RID: 3222 RVA: 0x00038D70 File Offset: 0x00036F70 private void CopyTo(KeyValuePair[] array, int index) { this.CopyToCheck(array, index); this.Do_CopyTo, KeyValuePair>(array, index, new Dictionary.Transform>(Dictionary.make_pair)); } // Token: 0x06000C97 RID: 3223 RVA: 0x00038D9C File Offset: 0x00036F9C private void Do_ICollectionCopyTo(Array array, int index, Dictionary.Transform transform) { Type typeFromHandle = typeof(TRet); Type elementType = array.GetType().GetElementType(); try { if ((typeFromHandle.IsPrimitive || elementType.IsPrimitive) && !elementType.IsAssignableFrom(typeFromHandle)) { throw new Exception(); } this.Do_CopyTo((object[])array, index, transform); } catch (Exception ex) { throw new ArgumentException("Cannot copy source collection elements to destination array", "array", ex); } } // Token: 0x06000C98 RID: 3224 RVA: 0x00038E30 File Offset: 0x00037030 private void Resize() { int num = Hashtable.ToPrime((this.table.Length << 1) | 1); int[] array = new int[num]; Link[] array2 = new Link[num]; for (int i = 0; i < this.table.Length; i++) { for (int num2 = this.table[i] - 1; num2 != -1; num2 = this.linkSlots[num2].Next) { int num3 = (array2[num2].HashCode = this.hcp.GetHashCode(this.keySlots[num2]) | int.MinValue); int num4 = (num3 & int.MaxValue) % num; array2[num2].Next = array[num4] - 1; array[num4] = num2 + 1; } } this.table = array; this.linkSlots = array2; TKey[] array3 = new TKey[num]; TValue[] array4 = new TValue[num]; Array.Copy(this.keySlots, 0, array3, 0, this.touchedSlots); Array.Copy(this.valueSlots, 0, array4, 0, this.touchedSlots); this.keySlots = array3; this.valueSlots = array4; this.threshold = (int)((float)num * 0.9f); } /// Adds the specified key and value to the dictionary. /// The key of the element to add. /// The value of the element to add. The value can be null for reference types. /// /// is null. /// An element with the same key already exists in the . // Token: 0x06000C99 RID: 3225 RVA: 0x00038F64 File Offset: 0x00037164 public void Add(TKey key, TValue value) { if (key == null) { throw new ArgumentNullException("key"); } int num = this.hcp.GetHashCode(key) | int.MinValue; int num2 = (num & int.MaxValue) % this.table.Length; int num3; for (num3 = this.table[num2] - 1; num3 != -1; num3 = this.linkSlots[num3].Next) { if (this.linkSlots[num3].HashCode == num && this.hcp.Equals(this.keySlots[num3], key)) { throw new ArgumentException("An element with the same key already exists in the dictionary."); } } if (++this.count > this.threshold) { this.Resize(); num2 = (num & int.MaxValue) % this.table.Length; } num3 = this.emptySlot; if (num3 == -1) { num3 = this.touchedSlots++; } else { this.emptySlot = this.linkSlots[num3].Next; } this.linkSlots[num3].HashCode = num; this.linkSlots[num3].Next = this.table[num2] - 1; this.table[num2] = num3 + 1; this.keySlots[num3] = key; this.valueSlots[num3] = value; this.generation++; } /// Gets the that is used to determine equality of keys for the dictionary. /// The generic interface implementation that is used to determine equality of keys for the current and to provide hash values for the keys. // Token: 0x170001D4 RID: 468 // (get) Token: 0x06000C9A RID: 3226 RVA: 0x000390E4 File Offset: 0x000372E4 public IEqualityComparer Comparer { get { return this.hcp; } } /// Removes all keys and values from the . // Token: 0x06000C9B RID: 3227 RVA: 0x000390EC File Offset: 0x000372EC public void Clear() { this.count = 0; Array.Clear(this.table, 0, this.table.Length); Array.Clear(this.keySlots, 0, this.keySlots.Length); Array.Clear(this.valueSlots, 0, this.valueSlots.Length); Array.Clear(this.linkSlots, 0, this.linkSlots.Length); this.emptySlot = -1; this.touchedSlots = 0; this.generation++; } /// Determines whether the contains the specified key. /// true if the contains an element with the specified key; otherwise, false. /// The key to locate in the . /// /// is null. // Token: 0x06000C9C RID: 3228 RVA: 0x0003916C File Offset: 0x0003736C public bool ContainsKey(TKey key) { if (key == null) { throw new ArgumentNullException("key"); } int num = this.hcp.GetHashCode(key) | int.MinValue; for (int num2 = this.table[(num & int.MaxValue) % this.table.Length] - 1; num2 != -1; num2 = this.linkSlots[num2].Next) { if (this.linkSlots[num2].HashCode == num && this.hcp.Equals(this.keySlots[num2], key)) { return true; } } return false; } /// Determines whether the contains a specific value. /// true if the contains an element with the specified value; otherwise, false. /// The value to locate in the . The value can be null for reference types. // Token: 0x06000C9D RID: 3229 RVA: 0x00039214 File Offset: 0x00037414 public bool ContainsValue(TValue value) { IEqualityComparer @default = EqualityComparer.Default; for (int i = 0; i < this.table.Length; i++) { for (int num = this.table[i] - 1; num != -1; num = this.linkSlots[num].Next) { if (@default.Equals(this.valueSlots[num], value)) { return true; } } } return false; } /// Implements the interface and returns the data needed to serialize the instance. /// A object that contains the information required to serialize the instance. /// A structure that contains the source and destination of the serialized stream associated with the instance. /// /// is null. // Token: 0x06000C9E RID: 3230 RVA: 0x00039284 File Offset: 0x00037484 public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } info.AddValue("Version", this.generation); info.AddValue("Comparer", this.hcp); KeyValuePair[] array = null; if (this.count > 0) { array = new KeyValuePair[this.count]; this.CopyTo(array, 0); } info.AddValue("HashSize", this.table.Length); info.AddValue("KeyValuePairs", array); } /// Implements the interface and raises the deserialization event when the deserialization is complete. /// The source of the deserialization event. /// The object associated with the current instance is invalid. // Token: 0x06000C9F RID: 3231 RVA: 0x00039308 File Offset: 0x00037508 public virtual void OnDeserialization(object sender) { if (this.serialization_info == null) { return; } this.generation = this.serialization_info.GetInt32("Version"); this.hcp = (IEqualityComparer)this.serialization_info.GetValue("Comparer", typeof(IEqualityComparer)); int num = this.serialization_info.GetInt32("HashSize"); KeyValuePair[] array = (KeyValuePair[])this.serialization_info.GetValue("KeyValuePairs", typeof(KeyValuePair[])); if (num < 10) { num = 10; } this.InitArrays(num); this.count = 0; if (array != null) { for (int i = 0; i < array.Length; i++) { this.Add(array[i].Key, array[i].Value); } } this.generation++; this.serialization_info = null; } /// Removes the value with the specified key from the . /// true if the element is successfully found and removed; otherwise, false. This method returns false if is not found in the . /// The key of the element to remove. /// /// is null. // Token: 0x06000CA0 RID: 3232 RVA: 0x000393F4 File Offset: 0x000375F4 public bool Remove(TKey key) { if (key == null) { throw new ArgumentNullException("key"); } int num = this.hcp.GetHashCode(key) | int.MinValue; int num2 = (num & int.MaxValue) % this.table.Length; int num3 = this.table[num2] - 1; if (num3 == -1) { return false; } int num4 = -1; while (this.linkSlots[num3].HashCode != num || !this.hcp.Equals(this.keySlots[num3], key)) { num4 = num3; num3 = this.linkSlots[num3].Next; if (num3 == -1) { IL_A4: if (num3 == -1) { return false; } this.count--; if (num4 == -1) { this.table[num2] = this.linkSlots[num3].Next + 1; } else { this.linkSlots[num4].Next = this.linkSlots[num3].Next; } this.linkSlots[num3].Next = this.emptySlot; this.emptySlot = num3; this.linkSlots[num3].HashCode = 0; this.keySlots[num3] = default(TKey); this.valueSlots[num3] = default(TValue); this.generation++; return true; } } goto IL_A4; } /// Gets the value associated with the specified key. /// true if the contains an element with the specified key; otherwise, false. /// The key of the value to get. /// When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized. /// /// is null. // Token: 0x06000CA1 RID: 3233 RVA: 0x00039570 File Offset: 0x00037770 public bool TryGetValue(TKey key, out TValue value) { if (key == null) { throw new ArgumentNullException("key"); } int num = this.hcp.GetHashCode(key) | int.MinValue; for (int num2 = this.table[(num & int.MaxValue) % this.table.Length] - 1; num2 != -1; num2 = this.linkSlots[num2].Next) { if (this.linkSlots[num2].HashCode == num && this.hcp.Equals(this.keySlots[num2], key)) { value = this.valueSlots[num2]; return true; } } value = default(TValue); return false; } /// Gets a collection containing the keys in the . /// A containing the keys in the . // Token: 0x170001D5 RID: 469 // (get) Token: 0x06000CA2 RID: 3234 RVA: 0x00039638 File Offset: 0x00037838 public Dictionary.KeyCollection Keys { get { return new Dictionary.KeyCollection(this); } } /// Gets a collection containing the values in the . /// A containing the values in the . // Token: 0x170001D6 RID: 470 // (get) Token: 0x06000CA3 RID: 3235 RVA: 0x00039640 File Offset: 0x00037840 public Dictionary.ValueCollection Values { get { return new Dictionary.ValueCollection(this); } } // Token: 0x06000CA4 RID: 3236 RVA: 0x00039648 File Offset: 0x00037848 private TKey ToTKey(object key) { if (key == null) { throw new ArgumentNullException("key"); } if (!(key is TKey)) { throw new ArgumentException("not of type: " + typeof(TKey).ToString(), "key"); } return (TKey)((object)key); } // Token: 0x06000CA5 RID: 3237 RVA: 0x0003969C File Offset: 0x0003789C private TValue ToTValue(object value) { if (value == null && !typeof(TValue).IsValueType) { return default(TValue); } if (!(value is TValue)) { throw new ArgumentException("not of type: " + typeof(TValue).ToString(), "value"); } return (TValue)((object)value); } // Token: 0x06000CA6 RID: 3238 RVA: 0x00039704 File Offset: 0x00037904 private bool ContainsKeyValuePair(KeyValuePair pair) { TValue tvalue; return this.TryGetValue(pair.Key, out tvalue) && EqualityComparer.Default.Equals(pair.Value, tvalue); } /// Returns an enumerator that iterates through the . /// A structure for the . // Token: 0x06000CA7 RID: 3239 RVA: 0x0003973C File Offset: 0x0003793C public Dictionary.Enumerator GetEnumerator() { return new Dictionary.Enumerator(this); } // Token: 0x04000362 RID: 866 private const int INITIAL_SIZE = 10; // Token: 0x04000363 RID: 867 private const float DEFAULT_LOAD_FACTOR = 0.9f; // Token: 0x04000364 RID: 868 private const int NO_SLOT = -1; // Token: 0x04000365 RID: 869 private const int HASH_FLAG = -2147483648; // Token: 0x04000366 RID: 870 private int[] table; // Token: 0x04000367 RID: 871 private Link[] linkSlots; // Token: 0x04000368 RID: 872 private TKey[] keySlots; // Token: 0x04000369 RID: 873 private TValue[] valueSlots; // Token: 0x0400036A RID: 874 private int touchedSlots; // Token: 0x0400036B RID: 875 private int emptySlot; // Token: 0x0400036C RID: 876 private int count; // Token: 0x0400036D RID: 877 private int threshold; // Token: 0x0400036E RID: 878 private IEqualityComparer hcp; // Token: 0x0400036F RID: 879 private SerializationInfo serialization_info; // Token: 0x04000370 RID: 880 private int generation; // Token: 0x02000100 RID: 256 [Serializable] private class ShimEnumerator : IEnumerator, IDictionaryEnumerator { // Token: 0x06000CA9 RID: 3241 RVA: 0x00039758 File Offset: 0x00037958 public ShimEnumerator(Dictionary host) { this.host_enumerator = host.GetEnumerator(); } // Token: 0x06000CAA RID: 3242 RVA: 0x0003976C File Offset: 0x0003796C public void Dispose() { this.host_enumerator.Dispose(); } // Token: 0x06000CAB RID: 3243 RVA: 0x0003977C File Offset: 0x0003797C public bool MoveNext() { return this.host_enumerator.MoveNext(); } // Token: 0x170001D7 RID: 471 // (get) Token: 0x06000CAC RID: 3244 RVA: 0x0003978C File Offset: 0x0003798C public DictionaryEntry Entry { get { return ((IDictionaryEnumerator)this.host_enumerator).Entry; } } // Token: 0x170001D8 RID: 472 // (get) Token: 0x06000CAD RID: 3245 RVA: 0x000397A0 File Offset: 0x000379A0 public object Key { get { KeyValuePair keyValuePair = this.host_enumerator.Current; return keyValuePair.Key; } } // Token: 0x170001D9 RID: 473 // (get) Token: 0x06000CAE RID: 3246 RVA: 0x000397C8 File Offset: 0x000379C8 public object Value { get { KeyValuePair keyValuePair = this.host_enumerator.Current; return keyValuePair.Value; } } // Token: 0x170001DA RID: 474 // (get) Token: 0x06000CAF RID: 3247 RVA: 0x000397F0 File Offset: 0x000379F0 public object Current { get { return this.Entry; } } // Token: 0x06000CB0 RID: 3248 RVA: 0x00039800 File Offset: 0x00037A00 public void Reset() { this.host_enumerator.Reset(); } // Token: 0x04000372 RID: 882 private Dictionary.Enumerator host_enumerator; } /// Enumerates the elements of a . // Token: 0x02000101 RID: 257 [Serializable] public struct Enumerator : IEnumerator, IDisposable, IEnumerator>, IDictionaryEnumerator { // Token: 0x06000CB1 RID: 3249 RVA: 0x00039810 File Offset: 0x00037A10 internal Enumerator(Dictionary dictionary) { this.dictionary = dictionary; this.stamp = dictionary.generation; } /// Gets the element at the current position of the enumerator. /// The element in the collection at the current position of the enumerator, as an . /// The enumerator is positioned before the first element of the collection or after the last element. // Token: 0x170001DB RID: 475 // (get) Token: 0x06000CB2 RID: 3250 RVA: 0x00039828 File Offset: 0x00037A28 object IEnumerator.Current { get { this.VerifyCurrent(); return this.current; } } /// Sets the enumerator to its initial position, which is before the first element in the collection. /// The collection was modified after the enumerator was created. // Token: 0x06000CB3 RID: 3251 RVA: 0x0003983C File Offset: 0x00037A3C void IEnumerator.Reset() { this.Reset(); } /// Gets the element at the current position of the enumerator. /// The element in the dictionary at the current position of the enumerator, as a . /// The enumerator is positioned before the first element of the collection or after the last element. // Token: 0x170001DC RID: 476 // (get) Token: 0x06000CB4 RID: 3252 RVA: 0x00039844 File Offset: 0x00037A44 DictionaryEntry IDictionaryEnumerator.Entry { get { this.VerifyCurrent(); return new DictionaryEntry(this.current.Key, this.current.Value); } } /// Gets the key of the element at the current position of the enumerator. /// The key of the element in the dictionary at the current position of the enumerator. /// The enumerator is positioned before the first element of the collection or after the last element. // Token: 0x170001DD RID: 477 // (get) Token: 0x06000CB5 RID: 3253 RVA: 0x0003987C File Offset: 0x00037A7C object IDictionaryEnumerator.Key { get { return this.CurrentKey; } } /// Gets the value of the element at the current position of the enumerator. /// The value of the element in the dictionary at the current position of the enumerator. /// The enumerator is positioned before the first element of the collection or after the last element. // Token: 0x170001DE RID: 478 // (get) Token: 0x06000CB6 RID: 3254 RVA: 0x0003988C File Offset: 0x00037A8C object IDictionaryEnumerator.Value { get { return this.CurrentValue; } } /// Advances the enumerator to the next element of the . /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. /// The collection was modified after the enumerator was created. // Token: 0x06000CB7 RID: 3255 RVA: 0x0003989C File Offset: 0x00037A9C public bool MoveNext() { this.VerifyState(); if (this.next < 0) { return false; } while (this.next < this.dictionary.touchedSlots) { int num = this.next++; if ((this.dictionary.linkSlots[num].HashCode & -2147483648) != 0) { this.current = new KeyValuePair(this.dictionary.keySlots[num], this.dictionary.valueSlots[num]); return true; } } this.next = -1; return false; } /// Gets the element at the current position of the enumerator. /// The element in the at the current position of the enumerator. // Token: 0x170001DF RID: 479 // (get) Token: 0x06000CB8 RID: 3256 RVA: 0x00039944 File Offset: 0x00037B44 public KeyValuePair Current { get { return this.current; } } // Token: 0x170001E0 RID: 480 // (get) Token: 0x06000CB9 RID: 3257 RVA: 0x0003994C File Offset: 0x00037B4C internal TKey CurrentKey { get { this.VerifyCurrent(); return this.current.Key; } } // Token: 0x170001E1 RID: 481 // (get) Token: 0x06000CBA RID: 3258 RVA: 0x00039960 File Offset: 0x00037B60 internal TValue CurrentValue { get { this.VerifyCurrent(); return this.current.Value; } } // Token: 0x06000CBB RID: 3259 RVA: 0x00039974 File Offset: 0x00037B74 internal void Reset() { this.VerifyState(); this.next = 0; } // Token: 0x06000CBC RID: 3260 RVA: 0x00039984 File Offset: 0x00037B84 private void VerifyState() { if (this.dictionary == null) { throw new ObjectDisposedException(null); } if (this.dictionary.generation != this.stamp) { throw new InvalidOperationException("out of sync"); } } // Token: 0x06000CBD RID: 3261 RVA: 0x000399BC File Offset: 0x00037BBC private void VerifyCurrent() { this.VerifyState(); if (this.next <= 0) { throw new InvalidOperationException("Current is not valid"); } } /// Releases all resources used by the . // Token: 0x06000CBE RID: 3262 RVA: 0x000399DC File Offset: 0x00037BDC public void Dispose() { this.dictionary = null; } // Token: 0x04000373 RID: 883 private Dictionary dictionary; // Token: 0x04000374 RID: 884 private int next; // Token: 0x04000375 RID: 885 private int stamp; // Token: 0x04000376 RID: 886 internal KeyValuePair current; } /// Represents the collection of keys in a . This class cannot be inherited. // Token: 0x02000102 RID: 258 [DebuggerDisplay("Count={Count}")] [DebuggerTypeProxy(typeof(CollectionDebuggerView<, >))] [Serializable] public sealed class KeyCollection : IEnumerable, ICollection, ICollection, IEnumerable { /// Initializes a new instance of the class that reflects the keys in the specified . /// The whose keys are reflected in the new . /// /// is null. // Token: 0x06000CBF RID: 3263 RVA: 0x000399E8 File Offset: 0x00037BE8 public KeyCollection(Dictionary dictionary) { if (dictionary == null) { throw new ArgumentNullException("dictionary"); } this.dictionary = dictionary; } // Token: 0x06000CC0 RID: 3264 RVA: 0x00039A08 File Offset: 0x00037C08 void ICollection.Add(TKey item) { throw new NotSupportedException("this is a read-only collection"); } // Token: 0x06000CC1 RID: 3265 RVA: 0x00039A14 File Offset: 0x00037C14 void ICollection.Clear() { throw new NotSupportedException("this is a read-only collection"); } // Token: 0x06000CC2 RID: 3266 RVA: 0x00039A20 File Offset: 0x00037C20 bool ICollection.Contains(TKey item) { return this.dictionary.ContainsKey(item); } // Token: 0x06000CC3 RID: 3267 RVA: 0x00039A30 File Offset: 0x00037C30 bool ICollection.Remove(TKey item) { throw new NotSupportedException("this is a read-only collection"); } // Token: 0x06000CC4 RID: 3268 RVA: 0x00039A3C File Offset: 0x00037C3C IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } /// Copies the elements of the to an , starting at a particular index. /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. /// The zero-based index in at which copying begins. /// /// is null. /// /// is less than zero. /// /// is multidimensional.-or- does not have zero-based indexing.-or-The number of elements in the source is greater than the available space from to the end of the destination .-or-The type of the source cannot be cast automatically to the type of the destination . // Token: 0x06000CC5 RID: 3269 RVA: 0x00039A4C File Offset: 0x00037C4C void ICollection.CopyTo(Array array, int index) { TKey[] array2 = array as TKey[]; if (array2 != null) { this.CopyTo(array2, index); return; } this.dictionary.CopyToCheck(array, index); this.dictionary.Do_ICollectionCopyTo(array, index, new Dictionary.Transform(Dictionary.pick_key)); } /// Returns an enumerator that iterates through a collection. /// An that can be used to iterate through the collection. // Token: 0x06000CC6 RID: 3270 RVA: 0x00039A98 File Offset: 0x00037C98 IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } // Token: 0x170001E2 RID: 482 // (get) Token: 0x06000CC7 RID: 3271 RVA: 0x00039AA8 File Offset: 0x00037CA8 bool ICollection.IsReadOnly { get { return true; } } /// Gets a value indicating whether access to the is synchronized (thread safe). /// true if access to the is synchronized (thread safe); otherwise, false. In the default implementation of , this property always returns false. // Token: 0x170001E3 RID: 483 // (get) Token: 0x06000CC8 RID: 3272 RVA: 0x00039AAC File Offset: 0x00037CAC bool ICollection.IsSynchronized { get { return false; } } /// Gets an object that can be used to synchronize access to the . /// An object that can be used to synchronize access to the . In the default implementation of , this property always returns the current instance. // Token: 0x170001E4 RID: 484 // (get) Token: 0x06000CC9 RID: 3273 RVA: 0x00039AB0 File Offset: 0x00037CB0 object ICollection.SyncRoot { get { return ((ICollection)this.dictionary).SyncRoot; } } /// Copies the elements to an existing one-dimensional , starting at the specified array index. /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. /// The zero-based index in at which copying begins. /// /// is null. /// /// is less than zero. /// The number of elements in the source is greater than the available space from to the end of the destination . // Token: 0x06000CCA RID: 3274 RVA: 0x00039AC0 File Offset: 0x00037CC0 public void CopyTo(TKey[] array, int index) { this.dictionary.CopyToCheck(array, index); this.dictionary.Do_CopyTo(array, index, new Dictionary.Transform(Dictionary.pick_key)); } /// Returns an enumerator that iterates through the . /// A for the . // Token: 0x06000CCB RID: 3275 RVA: 0x00039AF4 File Offset: 0x00037CF4 public Dictionary.KeyCollection.Enumerator GetEnumerator() { return new Dictionary.KeyCollection.Enumerator(this.dictionary); } /// Gets the number of elements contained in the . /// The number of elements contained in the .Retrieving the value of this property is an O(1) operation. // Token: 0x170001E5 RID: 485 // (get) Token: 0x06000CCC RID: 3276 RVA: 0x00039B04 File Offset: 0x00037D04 public int Count { get { return this.dictionary.Count; } } // Token: 0x04000377 RID: 887 private Dictionary dictionary; /// Enumerates the elements of a . // Token: 0x02000103 RID: 259 [Serializable] public struct Enumerator : IEnumerator, IDisposable, IEnumerator { // Token: 0x06000CCD RID: 3277 RVA: 0x00039B14 File Offset: 0x00037D14 internal Enumerator(Dictionary host) { this.host_enumerator = host.GetEnumerator(); } /// Gets the element at the current position of the enumerator. /// The element in the collection at the current position of the enumerator. /// The enumerator is positioned before the first element of the collection or after the last element. // Token: 0x170001E6 RID: 486 // (get) Token: 0x06000CCE RID: 3278 RVA: 0x00039B24 File Offset: 0x00037D24 object IEnumerator.Current { get { return this.host_enumerator.CurrentKey; } } /// Sets the enumerator to its initial position, which is before the first element in the collection. /// The collection was modified after the enumerator was created. // Token: 0x06000CCF RID: 3279 RVA: 0x00039B38 File Offset: 0x00037D38 void IEnumerator.Reset() { this.host_enumerator.Reset(); } /// Releases all resources used by the . // Token: 0x06000CD0 RID: 3280 RVA: 0x00039B48 File Offset: 0x00037D48 public void Dispose() { this.host_enumerator.Dispose(); } /// Advances the enumerator to the next element of the . /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. /// The collection was modified after the enumerator was created. // Token: 0x06000CD1 RID: 3281 RVA: 0x00039B58 File Offset: 0x00037D58 public bool MoveNext() { return this.host_enumerator.MoveNext(); } /// Gets the element at the current position of the enumerator. /// The element in the at the current position of the enumerator. // Token: 0x170001E7 RID: 487 // (get) Token: 0x06000CD2 RID: 3282 RVA: 0x00039B68 File Offset: 0x00037D68 public TKey Current { get { return this.host_enumerator.current.Key; } } // Token: 0x04000378 RID: 888 private Dictionary.Enumerator host_enumerator; } } /// Represents the collection of values in a . This class cannot be inherited. // Token: 0x02000104 RID: 260 [DebuggerTypeProxy(typeof(CollectionDebuggerView<, >))] [DebuggerDisplay("Count={Count}")] [Serializable] public sealed class ValueCollection : IEnumerable, ICollection, ICollection, IEnumerable { /// Initializes a new instance of the class that reflects the values in the specified . /// The whose values are reflected in the new . /// /// is null. // Token: 0x06000CD3 RID: 3283 RVA: 0x00039B7C File Offset: 0x00037D7C public ValueCollection(Dictionary dictionary) { if (dictionary == null) { throw new ArgumentNullException("dictionary"); } this.dictionary = dictionary; } // Token: 0x06000CD4 RID: 3284 RVA: 0x00039B9C File Offset: 0x00037D9C void ICollection.Add(TValue item) { throw new NotSupportedException("this is a read-only collection"); } // Token: 0x06000CD5 RID: 3285 RVA: 0x00039BA8 File Offset: 0x00037DA8 void ICollection.Clear() { throw new NotSupportedException("this is a read-only collection"); } // Token: 0x06000CD6 RID: 3286 RVA: 0x00039BB4 File Offset: 0x00037DB4 bool ICollection.Contains(TValue item) { return this.dictionary.ContainsValue(item); } // Token: 0x06000CD7 RID: 3287 RVA: 0x00039BC4 File Offset: 0x00037DC4 bool ICollection.Remove(TValue item) { throw new NotSupportedException("this is a read-only collection"); } // Token: 0x06000CD8 RID: 3288 RVA: 0x00039BD0 File Offset: 0x00037DD0 IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } /// Copies the elements of the to an , starting at a particular index. /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. /// The zero-based index in at which copying begins. /// /// is null. /// /// is less than zero. /// /// is multidimensional.-or- does not have zero-based indexing.-or-The number of elements in the source is greater than the available space from to the end of the destination .-or-The type of the source cannot be cast automatically to the type of the destination . // Token: 0x06000CD9 RID: 3289 RVA: 0x00039BE0 File Offset: 0x00037DE0 void ICollection.CopyTo(Array array, int index) { TValue[] array2 = array as TValue[]; if (array2 != null) { this.CopyTo(array2, index); return; } this.dictionary.CopyToCheck(array, index); this.dictionary.Do_ICollectionCopyTo(array, index, new Dictionary.Transform(Dictionary.pick_value)); } /// Returns an enumerator that iterates through a collection. /// An that can be used to iterate through the collection. // Token: 0x06000CDA RID: 3290 RVA: 0x00039C2C File Offset: 0x00037E2C IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } // Token: 0x170001E8 RID: 488 // (get) Token: 0x06000CDB RID: 3291 RVA: 0x00039C3C File Offset: 0x00037E3C bool ICollection.IsReadOnly { get { return true; } } /// Gets a value indicating whether access to the is synchronized (thread safe). /// true if access to the is synchronized (thread safe); otherwise, false. In the default implementation of , this property always returns false. // Token: 0x170001E9 RID: 489 // (get) Token: 0x06000CDC RID: 3292 RVA: 0x00039C40 File Offset: 0x00037E40 bool ICollection.IsSynchronized { get { return false; } } /// Gets an object that can be used to synchronize access to the . /// An object that can be used to synchronize access to the . In the default implementation of , this property always returns the current instance. // Token: 0x170001EA RID: 490 // (get) Token: 0x06000CDD RID: 3293 RVA: 0x00039C44 File Offset: 0x00037E44 object ICollection.SyncRoot { get { return ((ICollection)this.dictionary).SyncRoot; } } /// Copies the elements to an existing one-dimensional , starting at the specified array index. /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. /// The zero-based index in at which copying begins. /// /// is null. /// /// is less than zero. /// The number of elements in the source is greater than the available space from to the end of the destination . // Token: 0x06000CDE RID: 3294 RVA: 0x00039C54 File Offset: 0x00037E54 public void CopyTo(TValue[] array, int index) { this.dictionary.CopyToCheck(array, index); this.dictionary.Do_CopyTo(array, index, new Dictionary.Transform(Dictionary.pick_value)); } /// Returns an enumerator that iterates through the . /// A for the . // Token: 0x06000CDF RID: 3295 RVA: 0x00039C88 File Offset: 0x00037E88 public Dictionary.ValueCollection.Enumerator GetEnumerator() { return new Dictionary.ValueCollection.Enumerator(this.dictionary); } /// Gets the number of elements contained in the . /// The number of elements contained in the . // Token: 0x170001EB RID: 491 // (get) Token: 0x06000CE0 RID: 3296 RVA: 0x00039C98 File Offset: 0x00037E98 public int Count { get { return this.dictionary.Count; } } // Token: 0x04000379 RID: 889 private Dictionary dictionary; /// Enumerates the elements of a . // Token: 0x02000105 RID: 261 [Serializable] public struct Enumerator : IEnumerator, IDisposable, IEnumerator { // Token: 0x06000CE1 RID: 3297 RVA: 0x00039CA8 File Offset: 0x00037EA8 internal Enumerator(Dictionary host) { this.host_enumerator = host.GetEnumerator(); } /// Gets the element at the current position of the enumerator. /// The element in the collection at the current position of the enumerator. /// The enumerator is positioned before the first element of the collection or after the last element. // Token: 0x170001EC RID: 492 // (get) Token: 0x06000CE2 RID: 3298 RVA: 0x00039CB8 File Offset: 0x00037EB8 object IEnumerator.Current { get { return this.host_enumerator.CurrentValue; } } /// Sets the enumerator to its initial position, which is before the first element in the collection. /// The collection was modified after the enumerator was created. // Token: 0x06000CE3 RID: 3299 RVA: 0x00039CCC File Offset: 0x00037ECC void IEnumerator.Reset() { this.host_enumerator.Reset(); } /// Releases all resources used by the . // Token: 0x06000CE4 RID: 3300 RVA: 0x00039CDC File Offset: 0x00037EDC public void Dispose() { this.host_enumerator.Dispose(); } /// Advances the enumerator to the next element of the . /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. /// The collection was modified after the enumerator was created. // Token: 0x06000CE5 RID: 3301 RVA: 0x00039CEC File Offset: 0x00037EEC public bool MoveNext() { return this.host_enumerator.MoveNext(); } /// Gets the element at the current position of the enumerator. /// The element in the at the current position of the enumerator. // Token: 0x170001ED RID: 493 // (get) Token: 0x06000CE6 RID: 3302 RVA: 0x00039CFC File Offset: 0x00037EFC public TValue Current { get { return this.host_enumerator.current.Value; } } // Token: 0x0400037A RID: 890 private Dictionary.Enumerator host_enumerator; } } // Token: 0x020006C6 RID: 1734 // (Invoke) Token: 0x060041A0 RID: 16800 private delegate TRet Transform(TKey key, TValue value); } }