C#Dictionary源码

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
using System.Threading;

namespace System.Collections.Generic
{
    /// <summary>Represents a collection of keys and values.</summary>
    /// <typeparam name="TKey">The type of the keys in the dictionary.</typeparam>
    /// <typeparam name="TValue">The type of the values in the dictionary.</typeparam>
    // Token: 0x020004BD RID: 1213
    [DebuggerTypeProxy(typeof(Mscorlib_DictionaryDebugView<, >))]
    [DebuggerDisplay("Count = {Count}")]
    [ComVisible(false)]
    [__DynamicallyInvokable]
    [Serializable]
    public class Dictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IDictionary, ICollection, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, ISerializable, IDeserializationCallback
    {
        /// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Dictionary`2" /> class that is empty, has the default initial capacity, and uses the default equality comparer for the key type.</summary>
        // Token: 0x06003A5A RID: 14938 RVA: 0x000DF758 File Offset: 0x000DD958
        [__DynamicallyInvokable]
        public Dictionary() : this(0, null)
        {
        }

        /// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Dictionary`2" /> class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type.</summary>
        /// <param name="capacity">The initial number of elements that the <see cref="T:System.Collections.Generic.Dictionary`2" /> can contain.</param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="capacity" /> is less than 0.</exception>
        // Token: 0x06003A5B RID: 14939 RVA: 0x000DF762 File Offset: 0x000DD962
        [__DynamicallyInvokable]
        public Dictionary(int capacity) : this(capacity, null)
        {
        }

        /// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Dictionary`2" /> class that is empty, has the default initial capacity, and uses the specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" />.</summary>
        /// <param name="comparer">The <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> implementation to use when comparing keys, or <see langword="null" /> to use the default <see cref="T:System.Collections.Generic.EqualityComparer`1" /> for the type of the key.</param>
        // Token: 0x06003A5C RID: 14940 RVA: 0x000DF76C File Offset: 0x000DD96C
        [__DynamicallyInvokable]
        public Dictionary(IEqualityComparer<TKey> comparer) : this(0, comparer)
        {
        }

        /// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Dictionary`2" /> class that is empty, has the specified initial capacity, and uses the specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" />.</summary>
        /// <param name="capacity">The initial number of elements that the <see cref="T:System.Collections.Generic.Dictionary`2" /> can contain.</param>
        /// <param name="comparer">The <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> implementation to use when comparing keys, or <see langword="null" /> to use the default <see cref="T:System.Collections.Generic.EqualityComparer`1" /> for the type of the key.</param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="capacity" /> is less than 0.</exception>
        // Token: 0x06003A5D RID: 14941 RVA: 0x000DF776 File Offset: 0x000DD976
        [__DynamicallyInvokable]
        public Dictionary(int capacity, IEqualityComparer<TKey> comparer)
        {
            if (capacity < 0)
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.capacity);
            }
            if (capacity > 0)
            {
                this.Initialize(capacity);
            }
            this.comparer = (comparer ?? EqualityComparer<TKey>.Default);
        }

        /// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Dictionary`2" /> class that contains elements copied from the specified <see cref="T:System.Collections.Generic.IDictionary`2" /> and uses the default equality comparer for the key type.</summary>
        /// <param name="dictionary">The <see cref="T:System.Collections.Generic.IDictionary`2" /> whose elements are copied to the new <see cref="T:System.Collections.Generic.Dictionary`2" />.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="dictionary" /> is <see langword="null" />.</exception>
        /// <exception cref="T:System.ArgumentException">
        ///   <paramref name="dictionary" /> contains one or more duplicate keys.</exception>
        // Token: 0x06003A5E RID: 14942 RVA: 0x000DF7A4 File Offset: 0x000DD9A4
        [__DynamicallyInvokable]
        public Dictionary(IDictionary<TKey, TValue> dictionary) : this(dictionary, null)
        {
        }

        /// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Dictionary`2" /> class that contains elements copied from the specified <see cref="T:System.Collections.Generic.IDictionary`2" /> and uses the specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" />.</summary>
        /// <param name="dictionary">The <see cref="T:System.Collections.Generic.IDictionary`2" /> whose elements are copied to the new <see cref="T:System.Collections.Generic.Dictionary`2" />.</param>
        /// <param name="comparer">The <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> implementation to use when comparing keys, or <see langword="null" /> to use the default <see cref="T:System.Collections.Generic.EqualityComparer`1" /> for the type of the key.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="dictionary" /> is <see langword="null" />.</exception>
        /// <exception cref="T:System.ArgumentException">
        ///   <paramref name="dictionary" /> contains one or more duplicate keys.</exception>
        // Token: 0x06003A5F RID: 14943 RVA: 0x000DF7B0 File Offset: 0x000DD9B0
        [__DynamicallyInvokable]
        public Dictionary(IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer) : this((dictionary != null) ? dictionary.Count : 0, comparer)
        {
            if (dictionary == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.dictionary);
            }
            foreach (KeyValuePair<TKey, TValue> keyValuePair in dictionary)
            {
                this.Add(keyValuePair.Key, keyValuePair.Value);
            }
        }

        /// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Dictionary`2" /> class with serialized data.</summary>
        /// <param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object containing the information required to serialize the <see cref="T:System.Collections.Generic.Dictionary`2" />.</param>
        /// <param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> structure containing the source and destination of the serialized stream associated with the <see cref="T:System.Collections.Generic.Dictionary`2" />.</param>
        // Token: 0x06003A60 RID: 14944 RVA: 0x000DF824 File Offset: 0x000DDA24
        protected Dictionary(SerializationInfo info, StreamingContext context)
        {
            HashHelpers.SerializationInfoTable.Add(this, info);
        }

        /// <summary>Gets the <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> that is used to determine equality of keys for the dictionary.</summary>
        /// <returns>The <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> generic interface implementation that is used to determine equality of keys for the current <see cref="T:System.Collections.Generic.Dictionary`2" /> and to provide hash values for the keys.</returns>
        // Token: 0x170008CF RID: 2255
        // (get) Token: 0x06003A61 RID: 14945 RVA: 0x000DF838 File Offset: 0x000DDA38
        [__DynamicallyInvokable]
        public IEqualityComparer<TKey> Comparer
        {
            [__DynamicallyInvokable]
            get
            {
                return this.comparer;
            }
        }

        /// <summary>Gets the number of key/value pairs contained in the <see cref="T:System.Collections.Generic.Dictionary`2" />.</summary>
        /// <returns>The number of key/value pairs contained in the <see cref="T:System.Collections.Generic.Dictionary`2" />.</returns>
        // Token: 0x170008D0 RID: 2256
        // (get) Token: 0x06003A62 RID: 14946 RVA: 0x000DF840 File Offset: 0x000DDA40
        [__DynamicallyInvokable]
        public int Count
        {
            [__DynamicallyInvokable]
            get
            {
                return this.count - this.freeCount;
            }
        }

        /// <summary>Gets a collection containing the keys in the <see cref="T:System.Collections.Generic.Dictionary`2" />.</summary>
        /// <returns>A <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" /> containing the keys in the <see cref="T:System.Collections.Generic.Dictionary`2" />.</returns>
        // Token: 0x170008D1 RID: 2257
        // (get) Token: 0x06003A63 RID: 14947 RVA: 0x000DF84F File Offset: 0x000DDA4F
        [__DynamicallyInvokable]
        public Dictionary<TKey, TValue>.KeyCollection Keys
        {
            [__DynamicallyInvokable]
            get
            {
                if (this.keys == null)
                {
                    this.keys = new Dictionary<TKey, TValue>.KeyCollection(this);
                }
                return this.keys;
            }
        }

        // Token: 0x170008D2 RID: 2258
        // (get) Token: 0x06003A64 RID: 14948 RVA: 0x000DF86B File Offset: 0x000DDA6B
        [__DynamicallyInvokable]
        ICollection<TKey> IDictionary<!0, !1>.Keys
        {
            [__DynamicallyInvokable]
            get
            {
                if (this.keys == null)
                {
                    this.keys = new Dictionary<TKey, TValue>.KeyCollection(this);
                }
                return this.keys;
            }
        }

        // Token: 0x170008D3 RID: 2259
        // (get) Token: 0x06003A65 RID: 14949 RVA: 0x000DF887 File Offset: 0x000DDA87
        [__DynamicallyInvokable]
        IEnumerable<TKey> IReadOnlyDictionary<!0, !1>.Keys
        {
            [__DynamicallyInvokable]
            get
            {
                if (this.keys == null)
                {
                    this.keys = new Dictionary<TKey, TValue>.KeyCollection(this);
                }
                return this.keys;
            }
        }

        /// <summary>Gets a collection containing the values in the <see cref="T:System.Collections.Generic.Dictionary`2" />.</summary>
        /// <returns>A <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" /> containing the values in the <see cref="T:System.Collections.Generic.Dictionary`2" />.</returns>
        // Token: 0x170008D4 RID: 2260
        // (get) Token: 0x06003A66 RID: 14950 RVA: 0x000DF8A3 File Offset: 0x000DDAA3
        [__DynamicallyInvokable]
        public Dictionary<TKey, TValue>.ValueCollection Values
        {
            [__DynamicallyInvokable]
            get
            {
                if (this.values == null)
                {
                    this.values = new Dictionary<TKey, TValue>.ValueCollection(this);
                }
                return this.values;
            }
        }

        // Token: 0x170008D5 RID: 2261
        // (get) Token: 0x06003A67 RID: 14951 RVA: 0x000DF8BF File Offset: 0x000DDABF
        [__DynamicallyInvokable]
        ICollection<TValue> IDictionary<!0, !1>.Values
        {
            [__DynamicallyInvokable]
            get
            {
                if (this.values == null)
                {
                    this.values = new Dictionary<TKey, TValue>.ValueCollection(this);
                }
                return this.values;
            }
        }

        // Token: 0x170008D6 RID: 2262
        // (get) Token: 0x06003A68 RID: 14952 RVA: 0x000DF8DB File Offset: 0x000DDADB
        [__DynamicallyInvokable]
        IEnumerable<TValue> IReadOnlyDictionary<!0, !1>.Values
        {
            [__DynamicallyInvokable]
            get
            {
                if (this.values == null)
                {
                    this.values = new Dictionary<TKey, TValue>.ValueCollection(this);
                }
                return this.values;
            }
        }

        /// <summary>Gets or sets the value associated with the specified key.</summary>
        /// <param name="key">The key of the value to get or set.</param>
        /// <returns>The value associated with the specified key. If the specified key is not found, a get operation throws a <see cref="T:System.Collections.Generic.KeyNotFoundException" />, and a set operation creates a new element with the specified key.</returns>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="key" /> is <see langword="null" />.</exception>
        /// <exception cref="T:System.Collections.Generic.KeyNotFoundException">The property is retrieved and <paramref name="key" /> does not exist in the collection.</exception>
        // Token: 0x170008D7 RID: 2263
        [__DynamicallyInvokable]
        public TValue this[TKey key]
        {
            [__DynamicallyInvokable]
            get
            {
                int num = this.FindEntry(key);
                if (num >= 0)
                {
                    return this.entries[num].value;
                }
                ThrowHelper.ThrowKeyNotFoundException();
                return default(TValue);
            }
            [__DynamicallyInvokable]
            set
            {
                this.Insert(key, value, false);
            }
        }

        /// <summary>Adds the specified key and value to the dictionary.</summary>
        /// <param name="key">The key of the element to add.</param>
        /// <param name="value">The value of the element to add. The value can be <see langword="null" /> for reference types.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="key" /> is <see langword="null" />.</exception>
        /// <exception cref="T:System.ArgumentException">An element with the same key already exists in the <see cref="T:System.Collections.Generic.Dictionary`2" />.</exception>
        // Token: 0x06003A6B RID: 14955 RVA: 0x000DF93C File Offset: 0x000DDB3C
        [__DynamicallyInvokable]
        public void Add(TKey key, TValue value)
        {
            this.Insert(key, value, true);
        }

        // Token: 0x06003A6C RID: 14956 RVA: 0x000DF947 File Offset: 0x000DDB47
        [__DynamicallyInvokable]
        void ICollection<KeyValuePair<!0, !1>>.Add(KeyValuePair<TKey, TValue> keyValuePair)
        {
            this.Add(keyValuePair.Key, keyValuePair.Value);
        }

        // Token: 0x06003A6D RID: 14957 RVA: 0x000DF960 File Offset: 0x000DDB60
        [__DynamicallyInvokable]
        bool ICollection<KeyValuePair<!0, !1>>.Contains(KeyValuePair<TKey, TValue> keyValuePair)
        {
            int num = this.FindEntry(keyValuePair.Key);
            return num >= 0 && EqualityComparer<TValue>.Default.Equals(this.entries[num].value, keyValuePair.Value);
        }

        // Token: 0x06003A6E RID: 14958 RVA: 0x000DF9A8 File Offset: 0x000DDBA8
        [__DynamicallyInvokable]
        bool ICollection<KeyValuePair<!0, !1>>.Remove(KeyValuePair<TKey, TValue> keyValuePair)
        {
            int num = this.FindEntry(keyValuePair.Key);
            if (num >= 0 && EqualityComparer<TValue>.Default.Equals(this.entries[num].value, keyValuePair.Value))
            {
                this.Remove(keyValuePair.Key);
                return true;
            }
            return false;
        }

        /// <summary>Removes all keys and values from the <see cref="T:System.Collections.Generic.Dictionary`2" />.</summary>
        // Token: 0x06003A6F RID: 14959 RVA: 0x000DF9FC File Offset: 0x000DDBFC
        [__DynamicallyInvokable]
        public void Clear()
        {
            if (this.count > 0)
            {
                for (int i = 0; i < this.buckets.Length; i++)
                {
                    this.buckets[i] = -1;
                }
                Array.Clear(this.entries, 0, this.count);
                this.freeList = -1;
                this.count = 0;
                this.freeCount = 0;
                this.version++;
            }
        }

        /// <summary>Determines whether the <see cref="T:System.Collections.Generic.Dictionary`2" /> contains the specified key.</summary>
        /// <param name="key">The key to locate in the <see cref="T:System.Collections.Generic.Dictionary`2" />.</param>
        /// <returns>
        ///   <see langword="true" /> if the <see cref="T:System.Collections.Generic.Dictionary`2" /> contains an element with the specified key; otherwise, <see langword="false" />.</returns>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="key" /> is <see langword="null" />.</exception>
        // Token: 0x06003A70 RID: 14960 RVA: 0x000DFA63 File Offset: 0x000DDC63
        [__DynamicallyInvokable]
        public bool ContainsKey(TKey key)
        {
            return this.FindEntry(key) >= 0;
        }

        /// <summary>Determines whether the <see cref="T:System.Collections.Generic.Dictionary`2" /> contains a specific value.</summary>
        /// <param name="value">The value to locate in the <see cref="T:System.Collections.Generic.Dictionary`2" />. The value can be <see langword="null" /> for reference types.</param>
        /// <returns>
        ///   <see langword="true" /> if the <see cref="T:System.Collections.Generic.Dictionary`2" /> contains an element with the specified value; otherwise, <see langword="false" />.</returns>
        // Token: 0x06003A71 RID: 14961 RVA: 0x000DFA74 File Offset: 0x000DDC74
        [__DynamicallyInvokable]
        public bool ContainsValue(TValue value)
        {
            if (value == null)
            {
                for (int i = 0; i < this.count; i++)
                {
                    if (this.entries[i].hashCode >= 0 && this.entries[i].value == null)
                    {
                        return true;
                    }
                }
            }
            else
            {
                EqualityComparer<TValue> @default = EqualityComparer<TValue>.Default;
                for (int j = 0; j < this.count; j++)
                {
                    if (this.entries[j].hashCode >= 0 && @default.Equals(this.entries[j].value, value))
                    {
                        return true;
                    }
                }
            }
            return false;
        }

        // Token: 0x06003A72 RID: 14962 RVA: 0x000DFB14 File Offset: 0x000DDD14
        private void CopyTo(KeyValuePair<TKey, TValue>[] array, int index)
        {
            if (array == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
            }
            if (index < 0 || index > array.Length)
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
            }
            if (array.Length - index < this.Count)
            {
                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
            }
            int num = this.count;
            Dictionary<TKey, TValue>.Entry[] array2 = this.entries;
            for (int i = 0; i < num; i++)
            {
                if (array2[i].hashCode >= 0)
                {
                    array[index++] = new KeyValuePair<TKey, TValue>(array2[i].key, array2[i].value);
                }
            }
        }

        /// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.Dictionary`2" />.</summary>
        /// <returns>A <see cref="T:System.Collections.Generic.Dictionary`2.Enumerator" /> structure for the <see cref="T:System.Collections.Generic.Dictionary`2" />.</returns>
        // Token: 0x06003A73 RID: 14963 RVA: 0x000DFBA1 File Offset: 0x000DDDA1
        [__DynamicallyInvokable]
        public Dictionary<TKey, TValue>.Enumerator GetEnumerator()
        {
            return new Dictionary<TKey, TValue>.Enumerator(this, 2);
        }

        // Token: 0x06003A74 RID: 14964 RVA: 0x000DFBAA File Offset: 0x000DDDAA
        [__DynamicallyInvokable]
        IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<!0, !1>>.GetEnumerator()
        {
            return new Dictionary<TKey, TValue>.Enumerator(this, 2);
        }

        /// <summary>Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and returns the data needed to serialize the <see cref="T:System.Collections.Generic.Dictionary`2" /> instance.</summary>
        /// <param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that contains the information required to serialize the <see cref="T:System.Collections.Generic.Dictionary`2" /> instance.</param>
        /// <param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> structure that contains the source and destination of the serialized stream associated with the <see cref="T:System.Collections.Generic.Dictionary`2" /> instance.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="info" /> is <see langword="null" />.</exception>
        // Token: 0x06003A75 RID: 14965 RVA: 0x000DFBB8 File Offset: 0x000DDDB8
        [SecurityCritical]
        public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.info);
            }
            info.AddValue("Version", this.version);
            info.AddValue("Comparer", HashHelpers.GetEqualityComparerForSerialization(this.comparer), typeof(IEqualityComparer<TKey>));
            info.AddValue("HashSize", (this.buckets == null) ? 0 : this.buckets.Length);
            if (this.buckets != null)
            {
                KeyValuePair<TKey, TValue>[] array = new KeyValuePair<TKey, TValue>[this.Count];
                this.CopyTo(array, 0);
                info.AddValue("KeyValuePairs", array, typeof(KeyValuePair<TKey, TValue>[]));
            }
        }

        // Token: 0x06003A76 RID: 14966 RVA: 0x000DFC50 File Offset: 0x000DDE50
        private int FindEntry(TKey key)
        {
            if (key == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
            }
            if (this.buckets != null)
            {
                int num = this.comparer.GetHashCode(key) & int.MaxValue;
                for (int i = this.buckets[num % this.buckets.Length]; i >= 0; i = this.entries[i].next)
                {
                    if (this.entries[i].hashCode == num && this.comparer.Equals(this.entries[i].key, key))
                    {
                        return i;
                    }
                }
            }
            return -1;
        }

        // Token: 0x06003A77 RID: 14967 RVA: 0x000DFCE8 File Offset: 0x000DDEE8
        private void Initialize(int capacity)
        {
            int prime = HashHelpers.GetPrime(capacity);
            this.buckets = new int[prime];
            for (int i = 0; i < this.buckets.Length; i++)
            {
                this.buckets[i] = -1;
            }
            this.entries = new Dictionary<TKey, TValue>.Entry[prime];
            this.freeList = -1;
        }

        // Token: 0x06003A78 RID: 14968 RVA: 0x000DFD38 File Offset: 0x000DDF38
        private void Insert(TKey key, TValue value, bool add)
        {
            if (key == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
            }
            if (this.buckets == null)
            {
                this.Initialize(0);
            }
            int num = this.comparer.GetHashCode(key) & int.MaxValue;
            int num2 = num % this.buckets.Length;
            int num3 = 0;
            for (int i = this.buckets[num2]; i >= 0; i = this.entries[i].next)
            {
                if (this.entries[i].hashCode == num && this.comparer.Equals(this.entries[i].key, key))
                {
                    if (add)
                    {
                        ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_AddingDuplicate);
                    }
                    this.entries[i].value = value;
                    this.version++;
                    return;
                }
                num3++;
            }
            int num4;
            if (this.freeCount > 0)
            {
                num4 = this.freeList;
                this.freeList = this.entries[num4].next;
                this.freeCount--;
            }
            else
            {
                if (this.count == this.entries.Length)
                {
                    this.Resize();
                    num2 = num % this.buckets.Length;
                }
                num4 = this.count;
                this.count++;
            }
            this.entries[num4].hashCode = num;
            this.entries[num4].next = this.buckets[num2];
            this.entries[num4].key = key;
            this.entries[num4].value = value;
            this.buckets[num2] = num4;
            this.version++;
            if (num3 > 100 && HashHelpers.IsWellKnownEqualityComparer(this.comparer))
            {
                this.comparer = (IEqualityComparer<TKey>)HashHelpers.GetRandomizedEqualityComparer(this.comparer);
                this.Resize(this.entries.Length, true);
            }
        }

        /// <summary>Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and raises the deserialization event when the deserialization is complete.</summary>
        /// <param name="sender">The source of the deserialization event.</param>
        /// <exception cref="T:System.Runtime.Serialization.SerializationException">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object associated with the current <see cref="T:System.Collections.Generic.Dictionary`2" /> instance is invalid.</exception>
        // Token: 0x06003A79 RID: 14969 RVA: 0x000DFF18 File Offset: 0x000DE118
        public virtual void OnDeserialization(object sender)
        {
            SerializationInfo serializationInfo;
            HashHelpers.SerializationInfoTable.TryGetValue(this, out serializationInfo);
            if (serializationInfo == null)
            {
                return;
            }
            int @int = serializationInfo.GetInt32("Version");
            int int2 = serializationInfo.GetInt32("HashSize");
            this.comparer = (IEqualityComparer<TKey>)serializationInfo.GetValue("Comparer", typeof(IEqualityComparer<TKey>));
            if (int2 != 0)
            {
                this.buckets = new int[int2];
                for (int i = 0; i < this.buckets.Length; i++)
                {
                    this.buckets[i] = -1;
                }
                this.entries = new Dictionary<TKey, TValue>.Entry[int2];
                this.freeList = -1;
                KeyValuePair<TKey, TValue>[] array = (KeyValuePair<TKey, TValue>[])serializationInfo.GetValue("KeyValuePairs", typeof(KeyValuePair<TKey, TValue>[]));
                if (array == null)
                {
                    ThrowHelper.ThrowSerializationException(ExceptionResource.Serialization_MissingKeys);
                }
                for (int j = 0; j < array.Length; j++)
                {
                    if (array[j].Key == null)
                    {
                        ThrowHelper.ThrowSerializationException(ExceptionResource.Serialization_NullKey);
                    }
                    this.Insert(array[j].Key, array[j].Value, true);
                }
            }
            else
            {
                this.buckets = null;
            }
            this.version = @int;
            HashHelpers.SerializationInfoTable.Remove(this);
        }

        // Token: 0x06003A7A RID: 14970 RVA: 0x000E0044 File Offset: 0x000DE244
        private void Resize()
        {
            this.Resize(HashHelpers.ExpandPrime(this.count), false);
        }

        // Token: 0x06003A7B RID: 14971 RVA: 0x000E0058 File Offset: 0x000DE258
        private void Resize(int newSize, bool forceNewHashCodes)
        {
            int[] array = new int[newSize];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = -1;
            }
            Dictionary<TKey, TValue>.Entry[] array2 = new Dictionary<TKey, TValue>.Entry[newSize];
            Array.Copy(this.entries, 0, array2, 0, this.count);
            if (forceNewHashCodes)
            {
                for (int j = 0; j < this.count; j++)
                {
                    if (array2[j].hashCode != -1)
                    {
                        array2[j].hashCode = (this.comparer.GetHashCode(array2[j].key) & int.MaxValue);
                    }
                }
            }
            for (int k = 0; k < this.count; k++)
            {
                if (array2[k].hashCode >= 0)
                {
                    int num = array2[k].hashCode % newSize;
                    array2[k].next = array[num];
                    array[num] = k;
                }
            }
            this.buckets = array;
            this.entries = array2;
        }

        /// <summary>Removes the value with the specified key from the <see cref="T:System.Collections.Generic.Dictionary`2" />.</summary>
        /// <param name="key">The key of the element to remove.</param>
        /// <returns>
        ///   <see langword="true" /> if the element is successfully found and removed; otherwise, <see langword="false" />.  This method returns <see langword="false" /> if <paramref name="key" /> is not found in the <see cref="T:System.Collections.Generic.Dictionary`2" />.</returns>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="key" /> is <see langword="null" />.</exception>
        // Token: 0x06003A7C RID: 14972 RVA: 0x000E0140 File Offset: 0x000DE340
        [__DynamicallyInvokable]
        public bool Remove(TKey key)
        {
            if (key == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
            }
            if (this.buckets != null)
            {
                int num = this.comparer.GetHashCode(key) & int.MaxValue;
                int num2 = num % this.buckets.Length;
                int num3 = -1;
                for (int i = this.buckets[num2]; i >= 0; i = this.entries[i].next)
                {
                    if (this.entries[i].hashCode == num && this.comparer.Equals(this.entries[i].key, key))
                    {
                        if (num3 < 0)
                        {
                            this.buckets[num2] = this.entries[i].next;
                        }
                        else
                        {
                            this.entries[num3].next = this.entries[i].next;
                        }
                        this.entries[i].hashCode = -1;
                        this.entries[i].next = this.freeList;
                        this.entries[i].key = default(TKey);
                        this.entries[i].value = default(TValue);
                        this.freeList = i;
                        this.freeCount++;
                        this.version++;
                        return true;
                    }
                    num3 = i;
                }
            }
            return false;
        }

        /// <summary>Gets the value associated with the specified key.</summary>
        /// <param name="key">The key of the value to get.</param>
        /// <param name="value">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 <paramref name="value" /> parameter. This parameter is passed uninitialized.</param>
        /// <returns>
        ///   <see langword="true" /> if the <see cref="T:System.Collections.Generic.Dictionary`2" /> contains an element with the specified key; otherwise, <see langword="false" />.</returns>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="key" /> is <see langword="null" />.</exception>
        // Token: 0x06003A7D RID: 14973 RVA: 0x000E02A8 File Offset: 0x000DE4A8
        [__DynamicallyInvokable]
        public bool TryGetValue(TKey key, out TValue value)
        {
            int num = this.FindEntry(key);
            if (num >= 0)
            {
                value = this.entries[num].value;
                return true;
            }
            value = default(TValue);
            return false;
        }

        // Token: 0x06003A7E RID: 14974 RVA: 0x000E02E4 File Offset: 0x000DE4E4
        internal TValue GetValueOrDefault(TKey key)
        {
            int num = this.FindEntry(key);
            if (num >= 0)
            {
                return this.entries[num].value;
            }
            return default(TValue);
        }

        // Token: 0x170008D8 RID: 2264
        // (get) Token: 0x06003A7F RID: 14975 RVA: 0x000E0318 File Offset: 0x000DE518
        [__DynamicallyInvokable]
        bool ICollection<KeyValuePair<!0, !1>>.IsReadOnly
        {
            [__DynamicallyInvokable]
            get
            {
                return false;
            }
        }

        // Token: 0x06003A80 RID: 14976 RVA: 0x000E031B File Offset: 0x000DE51B
        [__DynamicallyInvokable]
        void ICollection<KeyValuePair<!0, !1>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int index)
        {
            this.CopyTo(array, index);
        }

        /// <summary>Copies the elements of the <see cref="T:System.Collections.Generic.ICollection`1" /> to an array, starting at the specified array index.</summary>
        /// <param name="array">The one-dimensional array that is the destination of the elements copied from <see cref="T:System.Collections.Generic.ICollection`1" />. The array must have zero-based indexing.</param>
        /// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="array" /> is <see langword="null" />.</exception>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="index" /> is less than 0.</exception>
        /// <exception cref="T:System.ArgumentException">
        ///   <paramref name="array" /> is multidimensional.  
        /// -or-  
        /// <paramref name="array" /> does not have zero-based indexing.  
        /// -or-  
        /// The number of elements in the source <see cref="T:System.Collections.Generic.ICollection`1" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.  
        /// -or-  
        /// The type of the source <see cref="T:System.Collections.Generic.ICollection`1" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
        // Token: 0x06003A81 RID: 14977 RVA: 0x000E0328 File Offset: 0x000DE528
        [__DynamicallyInvokable]
        void ICollection.CopyTo(Array array, int index)
        {
            if (array == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
            }
            if (array.Rank != 1)
            {
                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
            }
            if (array.GetLowerBound(0) != 0)
            {
                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
            }
            if (index < 0 || index > array.Length)
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
            }
            if (array.Length - index < this.Count)
            {
                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
            }
            KeyValuePair<TKey, TValue>[] array2 = array as KeyValuePair<TKey, TValue>[];
            if (array2 != null)
            {
                this.CopyTo(array2, index);
                return;
            }
            if (array is DictionaryEntry[])
            {
                DictionaryEntry[] array3 = array as DictionaryEntry[];
                Dictionary<TKey, TValue>.Entry[] array4 = this.entries;
                for (int i = 0; i < this.count; i++)
                {
                    if (array4[i].hashCode >= 0)
                    {
                        array3[index++] = new DictionaryEntry(array4[i].key, array4[i].value);
                    }
                }
                return;
            }
            object[] array5 = array as object[];
            if (array5 == null)
            {
                ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArrayType);
            }
            try
            {
                int num = this.count;
                Dictionary<TKey, TValue>.Entry[] array6 = this.entries;
                for (int j = 0; j < num; j++)
                {
                    if (array6[j].hashCode >= 0)
                    {
                        array5[index++] = new KeyValuePair<TKey, TValue>(array6[j].key, array6[j].value);
                    }
                }
            }
            catch (ArrayTypeMismatchException)
            {
                ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArrayType);
            }
        }

        /// <summary>Returns an enumerator that iterates through the collection.</summary>
        /// <returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the collection.</returns>
        // Token: 0x06003A82 RID: 14978 RVA: 0x000E0498 File Offset: 0x000DE698
        [__DynamicallyInvokable]
        IEnumerator IEnumerable.GetEnumerator()
        {
            return new Dictionary<TKey, TValue>.Enumerator(this, 2);
        }

        /// <summary>Gets a value that indicates whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
        /// <returns>
        ///   <see langword="true" /> if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, <see langword="false" />.  In the default implementation of <see cref="T:System.Collections.Generic.Dictionary`2" />, this property always returns <see langword="false" />.</returns>
        // Token: 0x170008D9 RID: 2265
        // (get) Token: 0x06003A83 RID: 14979 RVA: 0x000E04A6 File Offset: 0x000DE6A6
        [__DynamicallyInvokable]
        bool ICollection.IsSynchronized
        {
            [__DynamicallyInvokable]
            get
            {
                return false;
            }
        }

        /// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
        /// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</returns>
        // Token: 0x170008DA RID: 2266
        // (get) Token: 0x06003A84 RID: 14980 RVA: 0x000E04A9 File Offset: 0x000DE6A9
        [__DynamicallyInvokable]
        object ICollection.SyncRoot
        {
            [__DynamicallyInvokable]
            get
            {
                if (this._syncRoot == null)
                {
                    Interlocked.CompareExchange<object>(ref this._syncRoot, new object(), null);
                }
                return this._syncRoot;
            }
        }

        /// <summary>Gets a value that indicates whether the <see cref="T:System.Collections.IDictionary" /> has a fixed size.</summary>
        /// <returns>
        ///   <see langword="true" /> if the <see cref="T:System.Collections.IDictionary" /> has a fixed size; otherwise, <see langword="false" />.  In the default implementation of <see cref="T:System.Collections.Generic.Dictionary`2" />, this property always returns <see langword="false" />.</returns>
        // Token: 0x170008DB RID: 2267
        // (get) Token: 0x06003A85 RID: 14981 RVA: 0x000E04CB File Offset: 0x000DE6CB
        [__DynamicallyInvokable]
        bool IDictionary.IsFixedSize
        {
            [__DynamicallyInvokable]
            get
            {
                return false;
            }
        }

        /// <summary>Gets a value that indicates whether the <see cref="T:System.Collections.IDictionary" /> is read-only.</summary>
        /// <returns>
        ///   <see langword="true" /> if the <see cref="T:System.Collections.IDictionary" /> is read-only; otherwise, <see langword="false" />.  In the default implementation of <see cref="T:System.Collections.Generic.Dictionary`2" />, this property always returns <see langword="false" />.</returns>
        // Token: 0x170008DC RID: 2268
        // (get) Token: 0x06003A86 RID: 14982 RVA: 0x000E04CE File Offset: 0x000DE6CE
        [__DynamicallyInvokable]
        bool IDictionary.IsReadOnly
        {
            [__DynamicallyInvokable]
            get
            {
                return false;
            }
        }

        /// <summary>Gets an <see cref="T:System.Collections.ICollection" /> containing the keys of the <see cref="T:System.Collections.IDictionary" />.</summary>
        /// <returns>An <see cref="T:System.Collections.ICollection" /> containing the keys of the <see cref="T:System.Collections.IDictionary" />.</returns>
        // Token: 0x170008DD RID: 2269
        // (get) Token: 0x06003A87 RID: 14983 RVA: 0x000E04D1 File Offset: 0x000DE6D1
        [__DynamicallyInvokable]
        ICollection IDictionary.Keys
        {
            [__DynamicallyInvokable]
            get
            {
                return this.Keys;
            }
        }

        /// <summary>Gets an <see cref="T:System.Collections.ICollection" /> containing the values in the <see cref="T:System.Collections.IDictionary" />.</summary>
        /// <returns>An <see cref="T:System.Collections.ICollection" /> containing the values in the <see cref="T:System.Collections.IDictionary" />.</returns>
        // Token: 0x170008DE RID: 2270
        // (get) Token: 0x06003A88 RID: 14984 RVA: 0x000E04D9 File Offset: 0x000DE6D9
        [__DynamicallyInvokable]
        ICollection IDictionary.Values
        {
            [__DynamicallyInvokable]
            get
            {
                return this.Values;
            }
        }

        /// <summary>Gets or sets the value with the specified key.</summary>
        /// <param name="key">The key of the value to get.</param>
        /// <returns>The value associated with the specified key, or <see langword="null" /> if <paramref name="key" /> is not in the dictionary or <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.Generic.Dictionary`2" />.</returns>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="key" /> is <see langword="null" />.</exception>
        /// <exception cref="T:System.ArgumentException">A value is being assigned, and <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.Generic.Dictionary`2" />.  
        ///  -or-  
        ///  A value is being assigned, and <paramref name="value" /> is of a type that is not assignable to the value type <paramref name="TValue" /> of the <see cref="T:System.Collections.Generic.Dictionary`2" />.</exception>
        // Token: 0x170008DF RID: 2271
        [__DynamicallyInvokable]
        object IDictionary.this[object key]
        {
            [__DynamicallyInvokable]
            get
            {
                if (Dictionary<TKey, TValue>.IsCompatibleKey(key))
                {
                    int num = this.FindEntry((TKey)((object)key));
                    if (num >= 0)
                    {
                        return this.entries[num].value;
                    }
                }
                return null;
            }
            [__DynamicallyInvokable]
            set
            {
                if (key == null)
                {
                    ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
                }
                ThrowHelper.IfNullAndNullsAreIllegalThenThrow<TValue>(value, ExceptionArgument.value);
                try
                {
                    TKey key2 = (TKey)((object)key);
                    try
                    {
                        this[key2] = (TValue)((object)value);
                    }
                    catch (InvalidCastException)
                    {
                        ThrowHelper.ThrowWrongValueTypeArgumentException(value, typeof(TValue));
                    }
                }
                catch (InvalidCastException)
                {
                    ThrowHelper.ThrowWrongKeyTypeArgumentException(key, typeof(TKey));
                }
            }
        }

        // Token: 0x06003A8B RID: 14987 RVA: 0x000E059C File Offset: 0x000DE79C
        private static bool IsCompatibleKey(object key)
        {
            if (key == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
            }
            return key is TKey;
        }

        /// <summary>Adds the specified key and value to the dictionary.</summary>
        /// <param name="key">The object to use as the key.</param>
        /// <param name="value">The object to use as the value.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="key" /> is <see langword="null" />.</exception>
        /// <exception cref="T:System.ArgumentException">
        ///   <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.Generic.Dictionary`2" />.  
        /// -or-  
        /// <paramref name="value" /> is of a type that is not assignable to <paramref name="TValue" />, the type of values in the <see cref="T:System.Collections.Generic.Dictionary`2" />.  
        /// -or-  
        /// A value with the same key already exists in the <see cref="T:System.Collections.Generic.Dictionary`2" />.</exception>
        // Token: 0x06003A8C RID: 14988 RVA: 0x000E05B0 File Offset: 0x000DE7B0
        [__DynamicallyInvokable]
        void IDictionary.Add(object key, object value)
        {
            if (key == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
            }
            ThrowHelper.IfNullAndNullsAreIllegalThenThrow<TValue>(value, ExceptionArgument.value);
            try
            {
                TKey key2 = (TKey)((object)key);
                try
                {
                    this.Add(key2, (TValue)((object)value));
                }
                catch (InvalidCastException)
                {
                    ThrowHelper.ThrowWrongValueTypeArgumentException(value, typeof(TValue));
                }
            }
            catch (InvalidCastException)
            {
                ThrowHelper.ThrowWrongKeyTypeArgumentException(key, typeof(TKey));
            }
        }

        /// <summary>Determines whether the <see cref="T:System.Collections.IDictionary" /> contains an element with the specified key.</summary>
        /// <param name="key">The key to locate in the <see cref="T:System.Collections.IDictionary" />.</param>
        /// <returns>
        ///   <see langword="true" /> if the <see cref="T:System.Collections.IDictionary" /> contains an element with the specified key; otherwise, <see langword="false" />.</returns>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="key" /> is <see langword="null" />.</exception>
        // Token: 0x06003A8D RID: 14989 RVA: 0x000E0628 File Offset: 0x000DE828
        [__DynamicallyInvokable]
        bool IDictionary.Contains(object key)
        {
            return Dictionary<TKey, TValue>.IsCompatibleKey(key) && this.ContainsKey((TKey)((object)key));
        }

        /// <summary>Returns an <see cref="T:System.Collections.IDictionaryEnumerator" /> for the <see cref="T:System.Collections.IDictionary" />.</summary>
        /// <returns>An <see cref="T:System.Collections.IDictionaryEnumerator" /> for the <see cref="T:System.Collections.IDictionary" />.</returns>
        // Token: 0x06003A8E RID: 14990 RVA: 0x000E0640 File Offset: 0x000DE840
        [__DynamicallyInvokable]
        IDictionaryEnumerator IDictionary.GetEnumerator()
        {
            return new Dictionary<TKey, TValue>.Enumerator(this, 1);
        }

        /// <summary>Removes the element with the specified key from the <see cref="T:System.Collections.IDictionary" />.</summary>
        /// <param name="key">The key of the element to remove.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="key" /> is <see langword="null" />.</exception>
        // Token: 0x06003A8F RID: 14991 RVA: 0x000E064E File Offset: 0x000DE84E
        [__DynamicallyInvokable]
        void IDictionary.Remove(object key)
        {
            if (Dictionary<TKey, TValue>.IsCompatibleKey(key))
            {
                this.Remove((TKey)((object)key));
            }
        }

        // Token: 0x0400194A RID: 6474
        private int[] buckets;

        // Token: 0x0400194B RID: 6475
        private Dictionary<TKey, TValue>.Entry[] entries;

        // Token: 0x0400194C RID: 6476
        private int count;

        // Token: 0x0400194D RID: 6477
        private int version;

        // Token: 0x0400194E RID: 6478
        private int freeList;

        // Token: 0x0400194F RID: 6479
        private int freeCount;

        // Token: 0x04001950 RID: 6480
        private IEqualityComparer<TKey> comparer;

        // Token: 0x04001951 RID: 6481
        private Dictionary<TKey, TValue>.KeyCollection keys;

        // Token: 0x04001952 RID: 6482
        private Dictionary<TKey, TValue>.ValueCollection values;

        // Token: 0x04001953 RID: 6483
        private object _syncRoot;

        // Token: 0x04001954 RID: 6484
        private const string VersionName = "Version";

        // Token: 0x04001955 RID: 6485
        private const string HashSizeName = "HashSize";

        // Token: 0x04001956 RID: 6486
        private const string KeyValuePairsName = "KeyValuePairs";

        // Token: 0x04001957 RID: 6487
        private const string ComparerName = "Comparer";

        // Token: 0x02000BDB RID: 3035
        private struct Entry
        {
            // Token: 0x040035F4 RID: 13812
            public int hashCode;

            // Token: 0x040035F5 RID: 13813
            public int next;

            // Token: 0x040035F6 RID: 13814
            public TKey key;

            // Token: 0x040035F7 RID: 13815
            public TValue value;
        }

        /// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.Dictionary`2" />.</summary>
        /// <typeparam name="TKey" />
        /// <typeparam name="TValue" />
        // Token: 0x02000BDC RID: 3036
        [__DynamicallyInvokable]
        [Serializable]
        public struct Enumerator : IEnumerator<KeyValuePair<TKey, TValue>>, IDisposable, IEnumerator, IDictionaryEnumerator
        {
            // Token: 0x06006F27 RID: 28455 RVA: 0x0017FD66 File Offset: 0x0017DF66
            internal Enumerator(Dictionary<TKey, TValue> dictionary, int getEnumeratorRetType)
            {
                this.dictionary = dictionary;
                this.version = dictionary.version;
                this.index = 0;
                this.getEnumeratorRetType = getEnumeratorRetType;
                this.current = default(KeyValuePair<TKey, TValue>);
            }

            /// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.Dictionary`2" />.</summary>
            /// <returns>
            ///   <see langword="true" /> if the enumerator was successfully advanced to the next element; <see langword="false" /> if the enumerator has passed the end of the collection.</returns>
            /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
            // Token: 0x06006F28 RID: 28456 RVA: 0x0017FD98 File Offset: 0x0017DF98
            [__DynamicallyInvokable]
            public bool MoveNext()
            {
                if (this.version != this.dictionary.version)
                {
                    ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumFailedVersion);
                }
                while (this.index < this.dictionary.count)
                {
                    if (this.dictionary.entries[this.index].hashCode >= 0)
                    {
                        this.current = new KeyValuePair<TKey, TValue>(this.dictionary.entries[this.index].key, this.dictionary.entries[this.index].value);
                        this.index++;
                        return true;
                    }
                    this.index++;
                }
                this.index = this.dictionary.count + 1;
                this.current = default(KeyValuePair<TKey, TValue>);
                return false;
            }

            /// <summary>Gets the element at the current position of the enumerator.</summary>
            /// <returns>The element in the <see cref="T:System.Collections.Generic.Dictionary`2" /> at the current position of the enumerator.</returns>
            // Token: 0x17001309 RID: 4873
            // (get) Token: 0x06006F29 RID: 28457 RVA: 0x0017FE77 File Offset: 0x0017E077
            [__DynamicallyInvokable]
            public KeyValuePair<TKey, TValue> Current
            {
                [__DynamicallyInvokable]
                get
                {
                    return this.current;
                }
            }

            /// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.Dictionary`2.Enumerator" />.</summary>
            // Token: 0x06006F2A RID: 28458 RVA: 0x0017FE7F File Offset: 0x0017E07F
            [__DynamicallyInvokable]
            public void Dispose()
            {
            }

            /// <summary>Gets the element at the current position of the enumerator.</summary>
            /// <returns>The element in the collection at the current position of the enumerator, as an <see cref="T:System.Object" />.</returns>
            /// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element.</exception>
            // Token: 0x1700130A RID: 4874
            // (get) Token: 0x06006F2B RID: 28459 RVA: 0x0017FE84 File Offset: 0x0017E084
            [__DynamicallyInvokable]
            object IEnumerator.Current
            {
                [__DynamicallyInvokable]
                get
                {
                    if (this.index == 0 || this.index == this.dictionary.count + 1)
                    {
                        ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumOpCantHappen);
                    }
                    if (this.getEnumeratorRetType == 1)
                    {
                        return new DictionaryEntry(this.current.Key, this.current.Value);
                    }
                    return new KeyValuePair<TKey, TValue>(this.current.Key, this.current.Value);
                }
            }

            /// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
            /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
            // Token: 0x06006F2C RID: 28460 RVA: 0x0017FF09 File Offset: 0x0017E109
            [__DynamicallyInvokable]
            void IEnumerator.Reset()
            {
                if (this.version != this.dictionary.version)
                {
                    ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumFailedVersion);
                }
                this.index = 0;
                this.current = default(KeyValuePair<TKey, TValue>);
            }

            /// <summary>Gets the element at the current position of the enumerator.</summary>
            /// <returns>The element in the dictionary at the current position of the enumerator, as a <see cref="T:System.Collections.DictionaryEntry" />.</returns>
            /// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element.</exception>
            // Token: 0x1700130B RID: 4875
            // (get) Token: 0x06006F2D RID: 28461 RVA: 0x0017FF38 File Offset: 0x0017E138
            [__DynamicallyInvokable]
            DictionaryEntry IDictionaryEnumerator.Entry
            {
                [__DynamicallyInvokable]
                get
                {
                    if (this.index == 0 || this.index == this.dictionary.count + 1)
                    {
                        ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumOpCantHappen);
                    }
                    return new DictionaryEntry(this.current.Key, this.current.Value);
                }
            }

            /// <summary>Gets the key of the element at the current position of the enumerator.</summary>
            /// <returns>The key of the element in the dictionary at the current position of the enumerator.</returns>
            /// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element.</exception>
            // Token: 0x1700130C RID: 4876
            // (get) Token: 0x06006F2E RID: 28462 RVA: 0x0017FF8E File Offset: 0x0017E18E
            [__DynamicallyInvokable]
            object IDictionaryEnumerator.Key
            {
                [__DynamicallyInvokable]
                get
                {
                    if (this.index == 0 || this.index == this.dictionary.count + 1)
                    {
                        ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumOpCantHappen);
                    }
                    return this.current.Key;
                }
            }

            /// <summary>Gets the value of the element at the current position of the enumerator.</summary>
            /// <returns>The value of the element in the dictionary at the current position of the enumerator.</returns>
            /// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element.</exception>
            // Token: 0x1700130D RID: 4877
            // (get) Token: 0x06006F2F RID: 28463 RVA: 0x0017FFC4 File Offset: 0x0017E1C4
            [__DynamicallyInvokable]
            object IDictionaryEnumerator.Value
            {
                [__DynamicallyInvokable]
                get
                {
                    if (this.index == 0 || this.index == this.dictionary.count + 1)
                    {
                        ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumOpCantHappen);
                    }
                    return this.current.Value;
                }
            }

            // Token: 0x040035F8 RID: 13816
            private Dictionary<TKey, TValue> dictionary;

            // Token: 0x040035F9 RID: 13817
            private int version;

            // Token: 0x040035FA RID: 13818
            private int index;

            // Token: 0x040035FB RID: 13819
            private KeyValuePair<TKey, TValue> current;

            // Token: 0x040035FC RID: 13820
            private int getEnumeratorRetType;

            // Token: 0x040035FD RID: 13821
            internal const int DictEntry = 1;

            // Token: 0x040035FE RID: 13822
            internal const int KeyValuePair = 2;
        }

        /// <summary>Represents the collection of keys in a <see cref="T:System.Collections.Generic.Dictionary`2" />. This class cannot be inherited.</summary>
        /// <typeparam name="TKey" />
        /// <typeparam name="TValue" />
        // Token: 0x02000BDD RID: 3037
        [DebuggerTypeProxy(typeof(Mscorlib_DictionaryKeyCollectionDebugView<, >))]
        [DebuggerDisplay("Count = {Count}")]
        [__DynamicallyInvokable]
        [Serializable]
        public sealed class KeyCollection : ICollection<TKey>, IEnumerable<TKey>, IEnumerable, ICollection, IReadOnlyCollection<TKey>
        {
            /// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" /> class that reflects the keys in the specified <see cref="T:System.Collections.Generic.Dictionary`2" />.</summary>
            /// <param name="dictionary">The <see cref="T:System.Collections.Generic.Dictionary`2" /> whose keys are reflected in the new <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" />.</param>
            /// <exception cref="T:System.ArgumentNullException">
            ///   <paramref name="dictionary" /> is <see langword="null" />.</exception>
            // Token: 0x06006F30 RID: 28464 RVA: 0x0017FFFA File Offset: 0x0017E1FA
            [__DynamicallyInvokable]
            public KeyCollection(Dictionary<TKey, TValue> dictionary)
            {
                if (dictionary == null)
                {
                    ThrowHelper.ThrowArgumentNullException(ExceptionArgument.dictionary);
                }
                this.dictionary = dictionary;
            }

            /// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" />.</summary>
            /// <returns>A <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection.Enumerator" /> for the <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" />.</returns>
            // Token: 0x06006F31 RID: 28465 RVA: 0x00180012 File Offset: 0x0017E212
            [__DynamicallyInvokable]
            public Dictionary<TKey, TValue>.KeyCollection.Enumerator GetEnumerator()
            {
                return new Dictionary<TKey, TValue>.KeyCollection.Enumerator(this.dictionary);
            }

            /// <summary>Copies the <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" /> elements to an existing one-dimensional <see cref="T:System.Array" />, starting at the specified array index.</summary>
            /// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
            /// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
            /// <exception cref="T:System.ArgumentNullException">
            ///   <paramref name="array" /> is <see langword="null" />.</exception>
            /// <exception cref="T:System.ArgumentOutOfRangeException">
            ///   <paramref name="index" /> is less than zero.</exception>
            /// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
            // Token: 0x06006F32 RID: 28466 RVA: 0x00180020 File Offset: 0x0017E220
            [__DynamicallyInvokable]
            public void CopyTo(TKey[] array, int index)
            {
                if (array == null)
                {
                    ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
                }
                if (index < 0 || index > array.Length)
                {
                    ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
                }
                if (array.Length - index < this.dictionary.Count)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
                }
                int count = this.dictionary.count;
                Dictionary<TKey, TValue>.Entry[] entries = this.dictionary.entries;
                for (int i = 0; i < count; i++)
                {
                    if (entries[i].hashCode >= 0)
                    {
                        array[index++] = entries[i].key;
                    }
                }
            }

            /// <summary>Gets the number of elements contained in the <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" />.</summary>
            /// <returns>The number of elements contained in the <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" />.  
            ///  Retrieving the value of this property is an O(1) operation.</returns>
            // Token: 0x1700130E RID: 4878
            // (get) Token: 0x06006F33 RID: 28467 RVA: 0x001800AB File Offset: 0x0017E2AB
            [__DynamicallyInvokable]
            public int Count
            {
                [__DynamicallyInvokable]
                get
                {
                    return this.dictionary.Count;
                }
            }

            // Token: 0x1700130F RID: 4879
            // (get) Token: 0x06006F34 RID: 28468 RVA: 0x001800B8 File Offset: 0x0017E2B8
            [__DynamicallyInvokable]
            bool ICollection<!0>.IsReadOnly
            {
                [__DynamicallyInvokable]
                get
                {
                    return true;
                }
            }

            // Token: 0x06006F35 RID: 28469 RVA: 0x001800BB File Offset: 0x0017E2BB
            [__DynamicallyInvokable]
            void ICollection<!0>.Add(TKey item)
            {
                ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_KeyCollectionSet);
            }

            // Token: 0x06006F36 RID: 28470 RVA: 0x001800C4 File Offset: 0x0017E2C4
            [__DynamicallyInvokable]
            void ICollection<!0>.Clear()
            {
                ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_KeyCollectionSet);
            }

            // Token: 0x06006F37 RID: 28471 RVA: 0x001800CD File Offset: 0x0017E2CD
            [__DynamicallyInvokable]
            bool ICollection<!0>.Contains(TKey item)
            {
                return this.dictionary.ContainsKey(item);
            }

            // Token: 0x06006F38 RID: 28472 RVA: 0x001800DB File Offset: 0x0017E2DB
            [__DynamicallyInvokable]
            bool ICollection<!0>.Remove(TKey item)
            {
                ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_KeyCollectionSet);
                return false;
            }

            // Token: 0x06006F39 RID: 28473 RVA: 0x001800E5 File Offset: 0x0017E2E5
            [__DynamicallyInvokable]
            IEnumerator<TKey> IEnumerable<!0>.GetEnumerator()
            {
                return new Dictionary<TKey, TValue>.KeyCollection.Enumerator(this.dictionary);
            }

            /// <summary>Returns an enumerator that iterates through a collection.</summary>
            /// <returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the collection.</returns>
            // Token: 0x06006F3A RID: 28474 RVA: 0x001800F7 File Offset: 0x0017E2F7
            [__DynamicallyInvokable]
            IEnumerator IEnumerable.GetEnumerator()
            {
                return new Dictionary<TKey, TValue>.KeyCollection.Enumerator(this.dictionary);
            }

            /// <summary>Copies the elements of the <see cref="T:System.Collections.ICollection" /> to an <see cref="T:System.Array" />, starting at a particular <see cref="T:System.Array" /> index.</summary>
            /// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
            /// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
            /// <exception cref="T:System.ArgumentNullException">
            ///   <paramref name="array" /> is <see langword="null" />.</exception>
            /// <exception cref="T:System.ArgumentOutOfRangeException">
            ///   <paramref name="index" /> is less than zero.</exception>
            /// <exception cref="T:System.ArgumentException">
            ///   <paramref name="array" /> is multidimensional.  
            /// -or-  
            /// <paramref name="array" /> does not have zero-based indexing.  
            /// -or-  
            /// The number of elements in the source <see cref="T:System.Collections.ICollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.  
            /// -or-  
            /// The type of the source <see cref="T:System.Collections.ICollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
            // Token: 0x06006F3B RID: 28475 RVA: 0x0018010C File Offset: 0x0017E30C
            [__DynamicallyInvokable]
            void ICollection.CopyTo(Array array, int index)
            {
                if (array == null)
                {
                    ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
                }
                if (array.Rank != 1)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
                }
                if (array.GetLowerBound(0) != 0)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
                }
                if (index < 0 || index > array.Length)
                {
                    ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
                }
                if (array.Length - index < this.dictionary.Count)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
                }
                TKey[] array2 = array as TKey[];
                if (array2 != null)
                {
                    this.CopyTo(array2, index);
                    return;
                }
                object[] array3 = array as object[];
                if (array3 == null)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArrayType);
                }
                int count = this.dictionary.count;
                Dictionary<TKey, TValue>.Entry[] entries = this.dictionary.entries;
                try
                {
                    for (int i = 0; i < count; i++)
                    {
                        if (entries[i].hashCode >= 0)
                        {
                            array3[index++] = entries[i].key;
                        }
                    }
                }
                catch (ArrayTypeMismatchException)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArrayType);
                }
            }

            /// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
            /// <returns>
            ///   <see langword="true" /> if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, <see langword="false" />.  In the default implementation of <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" />, this property always returns <see langword="false" />.</returns>
            // Token: 0x17001310 RID: 4880
            // (get) Token: 0x06006F3C RID: 28476 RVA: 0x00180204 File Offset: 0x0017E404
            [__DynamicallyInvokable]
            bool ICollection.IsSynchronized
            {
                [__DynamicallyInvokable]
                get
                {
                    return false;
                }
            }

            /// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
            /// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.  In the default implementation of <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" />, this property always returns the current instance.</returns>
            // Token: 0x17001311 RID: 4881
            // (get) Token: 0x06006F3D RID: 28477 RVA: 0x00180207 File Offset: 0x0017E407
            [__DynamicallyInvokable]
            object ICollection.SyncRoot
            {
                [__DynamicallyInvokable]
                get
                {
                    return ((ICollection)this.dictionary).SyncRoot;
                }
            }

            // Token: 0x040035FF RID: 13823
            private Dictionary<TKey, TValue> dictionary;

            /// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" />.</summary>
            /// <typeparam name="TKey" />
            /// <typeparam name="TValue" />
            // Token: 0x02000D09 RID: 3337
            [__DynamicallyInvokable]
            [Serializable]
            public struct Enumerator : IEnumerator<TKey>, IDisposable, IEnumerator
            {
                // Token: 0x06007238 RID: 29240 RVA: 0x0018AB5A File Offset: 0x00188D5A
                internal Enumerator(Dictionary<TKey, TValue> dictionary)
                {
                    this.dictionary = dictionary;
                    this.version = dictionary.version;
                    this.index = 0;
                    this.currentKey = default(TKey);
                }

                /// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection.Enumerator" />.</summary>
                // Token: 0x06007239 RID: 29241 RVA: 0x0018AB82 File Offset: 0x00188D82
                [__DynamicallyInvokable]
                public void Dispose()
                {
                }

                /// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" />.</summary>
                /// <returns>
                ///   <see langword="true" /> if the enumerator was successfully advanced to the next element; <see langword="false" /> if the enumerator has passed the end of the collection.</returns>
                /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
                // Token: 0x0600723A RID: 29242 RVA: 0x0018AB84 File Offset: 0x00188D84
                [__DynamicallyInvokable]
                public bool MoveNext()
                {
                    if (this.version != this.dictionary.version)
                    {
                        ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumFailedVersion);
                    }
                    while (this.index < this.dictionary.count)
                    {
                        if (this.dictionary.entries[this.index].hashCode >= 0)
                        {
                            this.currentKey = this.dictionary.entries[this.index].key;
                            this.index++;
                            return true;
                        }
                        this.index++;
                    }
                    this.index = this.dictionary.count + 1;
                    this.currentKey = default(TKey);
                    return false;
                }

                /// <summary>Gets the element at the current position of the enumerator.</summary>
                /// <returns>The element in the <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection" /> at the current position of the enumerator.</returns>
                // Token: 0x1700138C RID: 5004
                // (get) Token: 0x0600723B RID: 29243 RVA: 0x0018AC3D File Offset: 0x00188E3D
                [__DynamicallyInvokable]
                public TKey Current
                {
                    [__DynamicallyInvokable]
                    get
                    {
                        return this.currentKey;
                    }
                }

                /// <summary>Gets the element at the current position of the enumerator.</summary>
                /// <returns>The element in the collection at the current position of the enumerator.</returns>
                /// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element.</exception>
                // Token: 0x1700138D RID: 5005
                // (get) Token: 0x0600723C RID: 29244 RVA: 0x0018AC45 File Offset: 0x00188E45
                [__DynamicallyInvokable]
                object IEnumerator.Current
                {
                    [__DynamicallyInvokable]
                    get
                    {
                        if (this.index == 0 || this.index == this.dictionary.count + 1)
                        {
                            ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumOpCantHappen);
                        }
                        return this.currentKey;
                    }
                }

                /// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
                /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
                // Token: 0x0600723D RID: 29245 RVA: 0x0018AC76 File Offset: 0x00188E76
                [__DynamicallyInvokable]
                void IEnumerator.Reset()
                {
                    if (this.version != this.dictionary.version)
                    {
                        ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumFailedVersion);
                    }
                    this.index = 0;
                    this.currentKey = default(TKey);
                }

                // Token: 0x04003962 RID: 14690
                private Dictionary<TKey, TValue> dictionary;

                // Token: 0x04003963 RID: 14691
                private int index;

                // Token: 0x04003964 RID: 14692
                private int version;

                // Token: 0x04003965 RID: 14693
                private TKey currentKey;
            }
        }

        /// <summary>Represents the collection of values in a <see cref="T:System.Collections.Generic.Dictionary`2" />. This class cannot be inherited.</summary>
        /// <typeparam name="TKey" />
        /// <typeparam name="TValue" />
        // Token: 0x02000BDE RID: 3038
        [DebuggerTypeProxy(typeof(Mscorlib_DictionaryValueCollectionDebugView<, >))]
        [DebuggerDisplay("Count = {Count}")]
        [__DynamicallyInvokable]
        [Serializable]
        public sealed class ValueCollection : ICollection<TValue>, IEnumerable<TValue>, IEnumerable, ICollection, IReadOnlyCollection<TValue>
        {
            /// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" /> class that reflects the values in the specified <see cref="T:System.Collections.Generic.Dictionary`2" />.</summary>
            /// <param name="dictionary">The <see cref="T:System.Collections.Generic.Dictionary`2" /> whose values are reflected in the new <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" />.</param>
            /// <exception cref="T:System.ArgumentNullException">
            ///   <paramref name="dictionary" /> is <see langword="null" />.</exception>
            // Token: 0x06006F3E RID: 28478 RVA: 0x00180214 File Offset: 0x0017E414
            [__DynamicallyInvokable]
            public ValueCollection(Dictionary<TKey, TValue> dictionary)
            {
                if (dictionary == null)
                {
                    ThrowHelper.ThrowArgumentNullException(ExceptionArgument.dictionary);
                }
                this.dictionary = dictionary;
            }

            /// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" />.</summary>
            /// <returns>A <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator" /> for the <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" />.</returns>
            // Token: 0x06006F3F RID: 28479 RVA: 0x0018022C File Offset: 0x0017E42C
            [__DynamicallyInvokable]
            public Dictionary<TKey, TValue>.ValueCollection.Enumerator GetEnumerator()
            {
                return new Dictionary<TKey, TValue>.ValueCollection.Enumerator(this.dictionary);
            }

            /// <summary>Copies the <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" /> elements to an existing one-dimensional <see cref="T:System.Array" />, starting at the specified array index.</summary>
            /// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
            /// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
            /// <exception cref="T:System.ArgumentNullException">
            ///   <paramref name="array" /> is <see langword="null" />.</exception>
            /// <exception cref="T:System.ArgumentOutOfRangeException">
            ///   <paramref name="index" /> is less than zero.</exception>
            /// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
            // Token: 0x06006F40 RID: 28480 RVA: 0x0018023C File Offset: 0x0017E43C
            [__DynamicallyInvokable]
            public void CopyTo(TValue[] array, int index)
            {
                if (array == null)
                {
                    ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
                }
                if (index < 0 || index > array.Length)
                {
                    ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
                }
                if (array.Length - index < this.dictionary.Count)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
                }
                int count = this.dictionary.count;
                Dictionary<TKey, TValue>.Entry[] entries = this.dictionary.entries;
                for (int i = 0; i < count; i++)
                {
                    if (entries[i].hashCode >= 0)
                    {
                        array[index++] = entries[i].value;
                    }
                }
            }

            /// <summary>Gets the number of elements contained in the <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" />.</summary>
            /// <returns>The number of elements contained in the <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" />.</returns>
            // Token: 0x17001312 RID: 4882
            // (get) Token: 0x06006F41 RID: 28481 RVA: 0x001802C7 File Offset: 0x0017E4C7
            [__DynamicallyInvokable]
            public int Count
            {
                [__DynamicallyInvokable]
                get
                {
                    return this.dictionary.Count;
                }
            }

            // Token: 0x17001313 RID: 4883
            // (get) Token: 0x06006F42 RID: 28482 RVA: 0x001802D4 File Offset: 0x0017E4D4
            [__DynamicallyInvokable]
            bool ICollection<!1>.IsReadOnly
            {
                [__DynamicallyInvokable]
                get
                {
                    return true;
                }
            }

            // Token: 0x06006F43 RID: 28483 RVA: 0x001802D7 File Offset: 0x0017E4D7
            [__DynamicallyInvokable]
            void ICollection<!1>.Add(TValue item)
            {
                ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ValueCollectionSet);
            }

            // Token: 0x06006F44 RID: 28484 RVA: 0x001802E0 File Offset: 0x0017E4E0
            [__DynamicallyInvokable]
            bool ICollection<!1>.Remove(TValue item)
            {
                ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ValueCollectionSet);
                return false;
            }

            // Token: 0x06006F45 RID: 28485 RVA: 0x001802EA File Offset: 0x0017E4EA
            [__DynamicallyInvokable]
            void ICollection<!1>.Clear()
            {
                ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ValueCollectionSet);
            }

            // Token: 0x06006F46 RID: 28486 RVA: 0x001802F3 File Offset: 0x0017E4F3
            [__DynamicallyInvokable]
            bool ICollection<!1>.Contains(TValue item)
            {
                return this.dictionary.ContainsValue(item);
            }

            // Token: 0x06006F47 RID: 28487 RVA: 0x00180301 File Offset: 0x0017E501
            [__DynamicallyInvokable]
            IEnumerator<TValue> IEnumerable<!1>.GetEnumerator()
            {
                return new Dictionary<TKey, TValue>.ValueCollection.Enumerator(this.dictionary);
            }

            /// <summary>Returns an enumerator that iterates through a collection.</summary>
            /// <returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the collection.</returns>
            // Token: 0x06006F48 RID: 28488 RVA: 0x00180313 File Offset: 0x0017E513
            [__DynamicallyInvokable]
            IEnumerator IEnumerable.GetEnumerator()
            {
                return new Dictionary<TKey, TValue>.ValueCollection.Enumerator(this.dictionary);
            }

            /// <summary>Copies the elements of the <see cref="T:System.Collections.ICollection" /> to an <see cref="T:System.Array" />, starting at a particular <see cref="T:System.Array" /> index.</summary>
            /// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
            /// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
            /// <exception cref="T:System.ArgumentNullException">
            ///   <paramref name="array" /> is <see langword="null" />.</exception>
            /// <exception cref="T:System.ArgumentOutOfRangeException">
            ///   <paramref name="index" /> is less than zero.</exception>
            /// <exception cref="T:System.ArgumentException">
            ///   <paramref name="array" /> is multidimensional.  
            /// -or-  
            /// <paramref name="array" /> does not have zero-based indexing.  
            /// -or-  
            /// The number of elements in the source <see cref="T:System.Collections.ICollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.  
            /// -or-  
            /// The type of the source <see cref="T:System.Collections.ICollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
            // Token: 0x06006F49 RID: 28489 RVA: 0x00180328 File Offset: 0x0017E528
            [__DynamicallyInvokable]
            void ICollection.CopyTo(Array array, int index)
            {
                if (array == null)
                {
                    ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
                }
                if (array.Rank != 1)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
                }
                if (array.GetLowerBound(0) != 0)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
                }
                if (index < 0 || index > array.Length)
                {
                    ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
                }
                if (array.Length - index < this.dictionary.Count)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
                }
                TValue[] array2 = array as TValue[];
                if (array2 != null)
                {
                    this.CopyTo(array2, index);
                    return;
                }
                object[] array3 = array as object[];
                if (array3 == null)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArrayType);
                }
                int count = this.dictionary.count;
                Dictionary<TKey, TValue>.Entry[] entries = this.dictionary.entries;
                try
                {
                    for (int i = 0; i < count; i++)
                    {
                        if (entries[i].hashCode >= 0)
                        {
                            array3[index++] = entries[i].value;
                        }
                    }
                }
                catch (ArrayTypeMismatchException)
                {
                    ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArrayType);
                }
            }

            /// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
            /// <returns>
            ///   <see langword="true" /> if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, <see langword="false" />.  In the default implementation of <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" />, this property always returns <see langword="false" />.</returns>
            // Token: 0x17001314 RID: 4884
            // (get) Token: 0x06006F4A RID: 28490 RVA: 0x00180420 File Offset: 0x0017E620
            [__DynamicallyInvokable]
            bool ICollection.IsSynchronized
            {
                [__DynamicallyInvokable]
                get
                {
                    return false;
                }
            }

            /// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
            /// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.  In the default implementation of <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" />, this property always returns the current instance.</returns>
            // Token: 0x17001315 RID: 4885
            // (get) Token: 0x06006F4B RID: 28491 RVA: 0x00180423 File Offset: 0x0017E623
            [__DynamicallyInvokable]
            object ICollection.SyncRoot
            {
                [__DynamicallyInvokable]
                get
                {
                    return ((ICollection)this.dictionary).SyncRoot;
                }
            }

            // Token: 0x04003600 RID: 13824
            private Dictionary<TKey, TValue> dictionary;

            /// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" />.</summary>
            /// <typeparam name="TKey" />
            /// <typeparam name="TValue" />
            // Token: 0x02000D0A RID: 3338
            [__DynamicallyInvokable]
            [Serializable]
            public struct Enumerator : IEnumerator<TValue>, IDisposable, IEnumerator
            {
                // Token: 0x0600723E RID: 29246 RVA: 0x0018ACA5 File Offset: 0x00188EA5
                internal Enumerator(Dictionary<TKey, TValue> dictionary)
                {
                    this.dictionary = dictionary;
                    this.version = dictionary.version;
                    this.index = 0;
                    this.currentValue = default(TValue);
                }

                /// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator" />.</summary>
                // Token: 0x0600723F RID: 29247 RVA: 0x0018ACCD File Offset: 0x00188ECD
                [__DynamicallyInvokable]
                public void Dispose()
                {
                }

                /// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" />.</summary>
                /// <returns>
                ///   <see langword="true" /> if the enumerator was successfully advanced to the next element; <see langword="false" /> if the enumerator has passed the end of the collection.</returns>
                /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
                // Token: 0x06007240 RID: 29248 RVA: 0x0018ACD0 File Offset: 0x00188ED0
                [__DynamicallyInvokable]
                public bool MoveNext()
                {
                    if (this.version != this.dictionary.version)
                    {
                        ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumFailedVersion);
                    }
                    while (this.index < this.dictionary.count)
                    {
                        if (this.dictionary.entries[this.index].hashCode >= 0)
                        {
                            this.currentValue = this.dictionary.entries[this.index].value;
                            this.index++;
                            return true;
                        }
                        this.index++;
                    }
                    this.index = this.dictionary.count + 1;
                    this.currentValue = default(TValue);
                    return false;
                }

                /// <summary>Gets the element at the current position of the enumerator.</summary>
                /// <returns>The element in the <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection" /> at the current position of the enumerator.</returns>
                // Token: 0x1700138E RID: 5006
                // (get) Token: 0x06007241 RID: 29249 RVA: 0x0018AD89 File Offset: 0x00188F89
                [__DynamicallyInvokable]
                public TValue Current
                {
                    [__DynamicallyInvokable]
                    get
                    {
                        return this.currentValue;
                    }
                }

                /// <summary>Gets the element at the current position of the enumerator.</summary>
                /// <returns>The element in the collection at the current position of the enumerator.</returns>
                /// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element.</exception>
                // Token: 0x1700138F RID: 5007
                // (get) Token: 0x06007242 RID: 29250 RVA: 0x0018AD91 File Offset: 0x00188F91
                [__DynamicallyInvokable]
                object IEnumerator.Current
                {
                    [__DynamicallyInvokable]
                    get
                    {
                        if (this.index == 0 || this.index == this.dictionary.count + 1)
                        {
                            ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumOpCantHappen);
                        }
                        return this.currentValue;
                    }
                }

                /// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
                /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
                // Token: 0x06007243 RID: 29251 RVA: 0x0018ADC2 File Offset: 0x00188FC2
                [__DynamicallyInvokable]
                void IEnumerator.Reset()
                {
                    if (this.version != this.dictionary.version)
                    {
                        ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumFailedVersion);
                    }
                    this.index = 0;
                    this.currentValue = default(TValue);
                }

                // Token: 0x04003966 RID: 14694
                private Dictionary<TKey, TValue> dictionary;

                // Token: 0x04003967 RID: 14695
                private int index;

                // Token: 0x04003968 RID: 14696
                private int version;

                // Token: 0x04003969 RID: 14697
                private TValue currentValue;
            }
        }
    }
}

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,921评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,635评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,393评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,836评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,833评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,685评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,043评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,694评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,671评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,670评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,779评论 1 332
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,424评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,027评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,984评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,214评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,108评论 2 351
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,517评论 2 343

推荐阅读更多精彩内容