using System;
namespace System.Collections.Specialized
{
/// Implements IDictionary by using a while the collection is small, and then switching to a when the collection gets large.
// Token: 0x02000028 RID: 40
[Serializable]
public class HybridDictionary : ICollection, IDictionary, IEnumerable
{
/// Creates an empty case-sensitive .
// Token: 0x06000193 RID: 403 RVA: 0x00006CF0 File Offset: 0x00004EF0
public HybridDictionary()
: this(0, false)
{
}
/// Creates an empty with the specified case sensitivity.
/// A Boolean that denotes whether the is case-insensitive.
// Token: 0x06000194 RID: 404 RVA: 0x00006CFC File Offset: 0x00004EFC
public HybridDictionary(bool caseInsensitive)
: this(0, caseInsensitive)
{
}
/// Creates a case-sensitive with the specified initial size.
/// The approximate number of entries that the can initially contain.
// Token: 0x06000195 RID: 405 RVA: 0x00006D08 File Offset: 0x00004F08
public HybridDictionary(int initialSize)
: this(initialSize, false)
{
}
/// Creates a with the specified initial size and case sensitivity.
/// The approximate number of entries that the can initially contain.
/// A Boolean that denotes whether the is case-insensitive.
// Token: 0x06000196 RID: 406 RVA: 0x00006D14 File Offset: 0x00004F14
public HybridDictionary(int initialSize, bool caseInsensitive)
{
this.caseInsensitive = caseInsensitive;
IComparer comparer = ((!caseInsensitive) ? null : CaseInsensitiveComparer.DefaultInvariant);
IHashCodeProvider hashCodeProvider = ((!caseInsensitive) ? null : CaseInsensitiveHashCodeProvider.DefaultInvariant);
if (initialSize <= 10)
{
this.list = new ListDictionary(comparer);
}
else
{
this.hashtable = new Hashtable(initialSize, hashCodeProvider, comparer);
}
}
/// Returns an that iterates through the .
/// An for the .
// Token: 0x06000197 RID: 407 RVA: 0x00006D7C File Offset: 0x00004F7C
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
// Token: 0x17000068 RID: 104
// (get) Token: 0x06000198 RID: 408 RVA: 0x00006D84 File Offset: 0x00004F84
private IDictionary inner
{
get
{
IDictionary dictionary2;
if (this.list == null)
{
IDictionary dictionary = this.hashtable;
dictionary2 = dictionary;
}
else
{
dictionary2 = this.list;
}
return dictionary2;
}
}
/// Gets the number of key/value pairs contained in the .
/// The number of key/value pairs contained in the .Retrieving the value of this property is an O(1) operation.
// Token: 0x17000069 RID: 105
// (get) Token: 0x06000199 RID: 409 RVA: 0x00006DB0 File Offset: 0x00004FB0
public int Count
{
get
{
return this.inner.Count;
}
}
/// Gets a value indicating whether the has a fixed size.
/// This property always returns false.
// Token: 0x1700006A RID: 106
// (get) Token: 0x0600019A RID: 410 RVA: 0x00006DC0 File Offset: 0x00004FC0
public bool IsFixedSize
{
get
{
return false;
}
}
/// Gets a value indicating whether the is read-only.
/// This property always returns false.
// Token: 0x1700006B RID: 107
// (get) Token: 0x0600019B RID: 411 RVA: 0x00006DC4 File Offset: 0x00004FC4
public bool IsReadOnly
{
get
{
return false;
}
}
/// Gets a value indicating whether the is synchronized (thread safe).
/// This property always returns false.
// Token: 0x1700006C RID: 108
// (get) Token: 0x0600019C RID: 412 RVA: 0x00006DC8 File Offset: 0x00004FC8
public bool IsSynchronized
{
get
{
return false;
}
}
/// Gets or sets the value associated with the specified key.
/// The value associated with the specified key. If the specified key is not found, attempting to get it returns null, and attempting to set it creates a new entry using the specified key.
/// The key whose value to get or set.
///
/// is null.
// Token: 0x1700006D RID: 109
public object this[object key]
{
get
{
return this.inner[key];
}
set
{
this.inner[key] = value;
if (this.list != null && this.Count > 10)
{
this.Switch();
}
}
}
/// Gets an containing the keys in the .
/// An containing the keys in the .
// Token: 0x1700006E RID: 110
// (get) Token: 0x0600019F RID: 415 RVA: 0x00006E0C File Offset: 0x0000500C
public ICollection Keys
{
get
{
return this.inner.Keys;
}
}
/// Gets an object that can be used to synchronize access to the .
/// An object that can be used to synchronize access to the .
// Token: 0x1700006F RID: 111
// (get) Token: 0x060001A0 RID: 416 RVA: 0x00006E1C File Offset: 0x0000501C
public object SyncRoot
{
get
{
return this;
}
}
/// Gets an containing the values in the .
/// An containing the values in the .
// Token: 0x17000070 RID: 112
// (get) Token: 0x060001A1 RID: 417 RVA: 0x00006E20 File Offset: 0x00005020
public ICollection Values
{
get
{
return this.inner.Values;
}
}
/// Adds an entry with the specified key and value into the .
/// The key of the entry to add.
/// The value of the entry to add. The value can be null.
///
/// is null.
/// An entry with the same key already exists in the .
// Token: 0x060001A2 RID: 418 RVA: 0x00006E30 File Offset: 0x00005030
public void Add(object key, object value)
{
this.inner.Add(key, value);
if (this.list != null && this.Count > 10)
{
this.Switch();
}
}
/// Removes all entries from the .
// Token: 0x060001A3 RID: 419 RVA: 0x00006E60 File Offset: 0x00005060
public void Clear()
{
this.inner.Clear();
}
/// Determines whether the contains a specific key.
/// true if the contains an entry with the specified key; otherwise, false.
/// The key to locate in the .
///
/// is null.
// Token: 0x060001A4 RID: 420 RVA: 0x00006E70 File Offset: 0x00005070
public bool Contains(object key)
{
return this.inner.Contains(key);
}
/// Copies the entries to a one-dimensional instance at the specified index.
/// The one-dimensional that is the destination of the objects copied from . The must have zero-based indexing.
/// The zero-based index in at which copying begins.
///
/// is null.
///
/// is less than zero.
///
/// is multidimensional.-or- The number of elements in the source is greater than the available space from to the end of the destination .
/// The type of the source cannot be cast automatically to the type of the destination .
// Token: 0x060001A5 RID: 421 RVA: 0x00006E80 File Offset: 0x00005080
public void CopyTo(Array array, int index)
{
this.inner.CopyTo(array, index);
}
/// Returns an that iterates through the .
/// An for the .
// Token: 0x060001A6 RID: 422 RVA: 0x00006E90 File Offset: 0x00005090
public IDictionaryEnumerator GetEnumerator()
{
return this.inner.GetEnumerator();
}
/// Removes the entry with the specified key from the .
/// The key of the entry to remove.
///
/// is null.
// Token: 0x060001A7 RID: 423 RVA: 0x00006EA0 File Offset: 0x000050A0
public void Remove(object key)
{
this.inner.Remove(key);
}
// Token: 0x060001A8 RID: 424 RVA: 0x00006EB0 File Offset: 0x000050B0
private void Switch()
{
IComparer comparer = ((!this.caseInsensitive) ? null : CaseInsensitiveComparer.DefaultInvariant);
IHashCodeProvider hashCodeProvider = ((!this.caseInsensitive) ? null : CaseInsensitiveHashCodeProvider.DefaultInvariant);
this.hashtable = new Hashtable(this.list, hashCodeProvider, comparer);
this.list.Clear();
this.list = null;
}
// Token: 0x04000082 RID: 130
private const int switchAfter = 10;
// Token: 0x04000083 RID: 131
private bool caseInsensitive;
// Token: 0x04000084 RID: 132
private Hashtable hashtable;
// Token: 0x04000085 RID: 133
private ListDictionary list;
}
}