Files
Dec2017-Script-Dump/System/Collections/Generic/SortedList.cs
T
2026-06-04 11:42:34 +02:00

1602 lines
54 KiB
C#

using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
/// <summary>Represents a collection of key/value pairs that are sorted by key based on the associated <see cref="T:System.Collections.Generic.IComparer`1" /> implementation.</summary>
/// <typeparam name="TKey">The type of keys in the collection.</typeparam>
/// <typeparam name="TValue">The type of values in the collection.</typeparam>
// Token: 0x0200001C RID: 28
[ComVisible(false)]
[Serializable]
public class SortedList<TKey, TValue> : ICollection, IDictionary, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IDictionary<TKey, TValue>
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that is empty, has the default initial capacity, and uses the default <see cref="T:System.Collections.Generic.IComparer`1" />.</summary>
// Token: 0x060000E8 RID: 232 RVA: 0x00004E14 File Offset: 0x00003014
public SortedList()
: this(SortedList<TKey, TValue>.INITIAL_SIZE, null)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that is empty, has the specified initial capacity, and uses the default <see cref="T:System.Collections.Generic.IComparer`1" />.</summary>
/// <param name="capacity">The initial number of elements that the <see cref="T:System.Collections.Generic.SortedList`2" /> can contain.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero.</exception>
// Token: 0x060000E9 RID: 233 RVA: 0x00004E24 File Offset: 0x00003024
public SortedList(int capacity)
: this(capacity, null)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that is empty, has the specified initial capacity, and uses the specified <see cref="T:System.Collections.Generic.IComparer`1" />.</summary>
/// <param name="capacity">The initial number of elements that the <see cref="T:System.Collections.Generic.SortedList`2" /> can contain.</param>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing keys.-or-null to use the default <see cref="T:System.Collections.Generic.Comparer`1" /> for the type of the key.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero.</exception>
// Token: 0x060000EA RID: 234 RVA: 0x00004E30 File Offset: 0x00003030
public SortedList(int capacity, IComparer<TKey> comparer)
{
if (capacity < 0)
{
throw new ArgumentOutOfRangeException("initialCapacity");
}
if (capacity == 0)
{
this.defaultCapacity = 0;
}
else
{
this.defaultCapacity = SortedList<TKey, TValue>.INITIAL_SIZE;
}
this.Init(comparer, capacity, true);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that is empty, has the default initial capacity, and uses the specified <see cref="T:System.Collections.Generic.IComparer`1" />.</summary>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing keys.-or-null to use the default <see cref="T:System.Collections.Generic.Comparer`1" /> for the type of the key.</param>
// Token: 0x060000EB RID: 235 RVA: 0x00004E7C File Offset: 0x0000307C
public SortedList(IComparer<TKey> comparer)
: this(SortedList<TKey, TValue>.INITIAL_SIZE, comparer)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that contains elements copied from the specified <see cref="T:System.Collections.Generic.IDictionary`2" />, has sufficient capacity to accommodate the number of elements copied, and uses the default <see cref="T:System.Collections.Generic.IComparer`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.SortedList`2" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="dictionary" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="dictionary" /> contains one or more duplicate keys.</exception>
// Token: 0x060000EC RID: 236 RVA: 0x00004E8C File Offset: 0x0000308C
public SortedList(IDictionary<TKey, TValue> dictionary)
: this(dictionary, null)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that contains elements copied from the specified <see cref="T:System.Collections.Generic.IDictionary`2" />, has sufficient capacity to accommodate the number of elements copied, and uses the specified <see cref="T:System.Collections.Generic.IComparer`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.SortedList`2" />.</param>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing keys.-or-null to use the default <see cref="T:System.Collections.Generic.Comparer`1" /> for the type of the key.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="dictionary" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="dictionary" /> contains one or more duplicate keys.</exception>
// Token: 0x060000ED RID: 237 RVA: 0x00004E98 File Offset: 0x00003098
public SortedList(IDictionary<TKey, TValue> dictionary, IComparer<TKey> comparer)
{
if (dictionary == null)
{
throw new ArgumentNullException("dictionary");
}
this.Init(comparer, dictionary.Count, true);
foreach (KeyValuePair<TKey, TValue> keyValuePair in dictionary)
{
this.Add(keyValuePair.Key, keyValuePair.Value);
}
}
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
/// <returns>true if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedList`2" />, this property always returns false.</returns>
// Token: 0x1700003C RID: 60
// (get) Token: 0x060000EF RID: 239 RVA: 0x00004F34 File Offset: 0x00003134
bool ICollection.IsSynchronized
{
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.SortedList`2" />, this property always returns the current instance.</returns>
// Token: 0x1700003D RID: 61
// (get) Token: 0x060000F0 RID: 240 RVA: 0x00004F38 File Offset: 0x00003138
object ICollection.SyncRoot
{
get
{
return this;
}
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IDictionary" /> has a fixed size.</summary>
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> has a fixed size; otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedList`2" />, this property always returns false.</returns>
// Token: 0x1700003E RID: 62
// (get) Token: 0x060000F1 RID: 241 RVA: 0x00004F3C File Offset: 0x0000313C
bool IDictionary.IsFixedSize
{
get
{
return false;
}
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IDictionary" /> is read-only.</summary>
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> is read-only; otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedList`2" />, this property always returns false.</returns>
// Token: 0x1700003F RID: 63
// (get) Token: 0x060000F2 RID: 242 RVA: 0x00004F40 File Offset: 0x00003140
bool IDictionary.IsReadOnly
{
get
{
return false;
}
}
/// <summary>Gets or sets the element with the specified key.</summary>
/// <returns>The element with the specified key, or 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.SortedList`2" />.</returns>
/// <param name="key">The key of the element to get or set.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is 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.SortedList`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.SortedList`2" />.</exception>
// Token: 0x17000040 RID: 64
object IDictionary.this[object key]
{
get
{
if (!(key is TKey))
{
return null;
}
return this[(TKey)((object)key)];
}
set
{
this[this.ToKey(key)] = this.ToValue(value);
}
}
/// <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: 0x17000041 RID: 65
// (get) Token: 0x060000F5 RID: 245 RVA: 0x00004F7C File Offset: 0x0000317C
ICollection IDictionary.Keys
{
get
{
return new SortedList<TKey, TValue>.ListKeys(this);
}
}
/// <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: 0x17000042 RID: 66
// (get) Token: 0x060000F6 RID: 246 RVA: 0x00004F84 File Offset: 0x00003184
ICollection IDictionary.Values
{
get
{
return new SortedList<TKey, TValue>.ListValues(this);
}
}
// Token: 0x17000043 RID: 67
// (get) Token: 0x060000F7 RID: 247 RVA: 0x00004F8C File Offset: 0x0000318C
ICollection<TKey> IDictionary<TKey, TValue>.Keys
{
get
{
return this.Keys;
}
}
// Token: 0x17000044 RID: 68
// (get) Token: 0x060000F8 RID: 248 RVA: 0x00004F94 File Offset: 0x00003194
ICollection<TValue> IDictionary<TKey, TValue>.Values
{
get
{
return this.Values;
}
}
// Token: 0x17000045 RID: 69
// (get) Token: 0x060000F9 RID: 249 RVA: 0x00004F9C File Offset: 0x0000319C
bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly
{
get
{
return false;
}
}
// Token: 0x060000FA RID: 250 RVA: 0x00004FA0 File Offset: 0x000031A0
void ICollection<KeyValuePair<TKey, TValue>>.Clear()
{
this.defaultCapacity = SortedList<TKey, TValue>.INITIAL_SIZE;
this.table = new KeyValuePair<TKey, TValue>[this.defaultCapacity];
this.inUse = 0;
this.modificationCount++;
}
// Token: 0x060000FB RID: 251 RVA: 0x00004FD4 File Offset: 0x000031D4
void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
{
if (this.Count == 0)
{
return;
}
if (array == null)
{
throw new ArgumentNullException();
}
if (arrayIndex < 0)
{
throw new ArgumentOutOfRangeException();
}
if (arrayIndex >= array.Length)
{
throw new ArgumentNullException("arrayIndex is greater than or equal to array.Length");
}
if (this.Count > array.Length - arrayIndex)
{
throw new ArgumentNullException("Not enough space in array from arrayIndex to end of array");
}
int num = arrayIndex;
foreach (KeyValuePair<TKey, TValue> keyValuePair in this)
{
array[num++] = keyValuePair;
}
}
// Token: 0x060000FC RID: 252 RVA: 0x00005094 File Offset: 0x00003294
void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> keyValuePair)
{
this.Add(keyValuePair.Key, keyValuePair.Value);
}
// Token: 0x060000FD RID: 253 RVA: 0x000050AC File Offset: 0x000032AC
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> keyValuePair)
{
int num = this.Find(keyValuePair.Key);
return num >= 0 && Comparer<KeyValuePair<TKey, TValue>>.Default.Compare(this.table[num], keyValuePair) == 0;
}
// Token: 0x060000FE RID: 254 RVA: 0x000050F0 File Offset: 0x000032F0
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> keyValuePair)
{
int num = this.Find(keyValuePair.Key);
if (num >= 0 && Comparer<KeyValuePair<TKey, TValue>>.Default.Compare(this.table[num], keyValuePair) == 0)
{
this.RemoveAt(num);
return true;
}
return false;
}
// Token: 0x060000FF RID: 255 RVA: 0x00005140 File Offset: 0x00003340
IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
{
for (int i = 0; i < this.inUse; i++)
{
KeyValuePair<TKey, TValue> current = this.table[i];
yield return new KeyValuePair<TKey, TValue>(current.Key, current.Value);
}
yield break;
}
/// <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: 0x06000100 RID: 256 RVA: 0x0000515C File Offset: 0x0000335C
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>Adds an element with the provided key and value to the <see cref="T:System.Collections.IDictionary" />.</summary>
/// <param name="key">The <see cref="T:System.Object" /> to use as the key of the element to add.</param>
/// <param name="value">The <see cref="T:System.Object" /> to use as the value of the element to add.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is 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.IDictionary" />.-or-<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.IDictionary" />.-or-An element with the same key already exists in the <see cref="T:System.Collections.IDictionary" />.</exception>
// Token: 0x06000101 RID: 257 RVA: 0x00005164 File Offset: 0x00003364
void IDictionary.Add(object key, object value)
{
this.PutImpl(this.ToKey(key), this.ToValue(value), false);
}
/// <summary>Determines whether the <see cref="T:System.Collections.IDictionary" /> contains an element with the specified key.</summary>
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> contains an element with the key; otherwise, false.</returns>
/// <param name="key">The key to locate in the <see cref="T:System.Collections.IDictionary" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// Token: 0x06000102 RID: 258 RVA: 0x00005188 File Offset: 0x00003388
bool IDictionary.Contains(object key)
{
if (key == null)
{
throw new ArgumentNullException();
}
return key is TKey && this.Find((TKey)((object)key)) >= 0;
}
/// <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: 0x06000103 RID: 259 RVA: 0x000051B8 File Offset: 0x000033B8
IDictionaryEnumerator IDictionary.GetEnumerator()
{
return new SortedList<TKey, TValue>.Enumerator(this, SortedList<TKey, TValue>.EnumeratorMode.ENTRY_MODE);
}
/// <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 null.</exception>
// Token: 0x06000104 RID: 260 RVA: 0x000051C4 File Offset: 0x000033C4
void IDictionary.Remove(object key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
if (!(key is TKey))
{
return;
}
int num = this.IndexOfKey((TKey)((object)key));
if (num >= 0)
{
this.RemoveAt(num);
}
}
/// <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="arrayIndex">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="arrayIndex" /> 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="arrayIndex" /> 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: 0x06000105 RID: 261 RVA: 0x0000520C File Offset: 0x0000340C
void ICollection.CopyTo(Array array, int arrayIndex)
{
if (this.Count == 0)
{
return;
}
if (array == null)
{
throw new ArgumentNullException();
}
if (arrayIndex < 0)
{
throw new ArgumentOutOfRangeException();
}
if (array.Rank > 1)
{
throw new ArgumentException("array is multi-dimensional");
}
if (arrayIndex >= array.Length)
{
throw new ArgumentNullException("arrayIndex is greater than or equal to array.Length");
}
if (this.Count > array.Length - arrayIndex)
{
throw new ArgumentNullException("Not enough space in array from arrayIndex to end of array");
}
IEnumerator<KeyValuePair<TKey, TValue>> enumerator = this.GetEnumerator();
int num = arrayIndex;
while (enumerator.MoveNext())
{
KeyValuePair<TKey, TValue> keyValuePair = enumerator.Current;
array.SetValue(keyValuePair, num++);
}
}
/// <summary>Gets the number of key/value pairs contained in the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>The number of key/value pairs contained in the <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
// Token: 0x17000046 RID: 70
// (get) Token: 0x06000106 RID: 262 RVA: 0x000052BC File Offset: 0x000034BC
public int Count
{
get
{
return this.inUse;
}
}
/// <summary>Gets or sets the value associated with the specified key.</summary>
/// <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 using the specified key.</returns>
/// <param name="key">The key whose value to get or set.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is 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: 0x17000047 RID: 71
public TValue this[TKey key]
{
get
{
if (key == null)
{
throw new ArgumentNullException("key");
}
int num = this.Find(key);
if (num >= 0)
{
return this.table[num].Value;
}
throw new KeyNotFoundException();
}
set
{
if (key == null)
{
throw new ArgumentNullException("key");
}
this.PutImpl(key, value, true);
}
}
/// <summary>Gets or sets the number of elements that the <see cref="T:System.Collections.Generic.SortedList`2" /> can contain.</summary>
/// <returns>The number of elements that the <see cref="T:System.Collections.Generic.SortedList`2" /> can contain.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <see cref="P:System.Collections.Generic.SortedList`2.Capacity" /> is set to a value that is less than <see cref="P:System.Collections.Generic.SortedList`2.Count" />.</exception>
/// <exception cref="T:System.OutOfMemoryException">There is not enough memory available on the system.</exception>
// Token: 0x17000048 RID: 72
// (get) Token: 0x06000109 RID: 265 RVA: 0x00005334 File Offset: 0x00003534
// (set) Token: 0x0600010A RID: 266 RVA: 0x00005340 File Offset: 0x00003540
public int Capacity
{
get
{
return this.table.Length;
}
set
{
int num = this.table.Length;
if (this.inUse > value)
{
throw new ArgumentOutOfRangeException("capacity too small");
}
if (value == 0)
{
KeyValuePair<TKey, TValue>[] array = new KeyValuePair<TKey, TValue>[this.defaultCapacity];
Array.Copy(this.table, array, this.inUse);
this.table = array;
}
else if (value > this.inUse)
{
KeyValuePair<TKey, TValue>[] array2 = new KeyValuePair<TKey, TValue>[value];
Array.Copy(this.table, array2, this.inUse);
this.table = array2;
}
else if (value > num)
{
KeyValuePair<TKey, TValue>[] array3 = new KeyValuePair<TKey, TValue>[value];
Array.Copy(this.table, array3, num);
this.table = array3;
}
}
}
/// <summary>Gets a collection containing the keys in the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>A <see cref="T:System.Collections.Generic.IList`1" /> containing the keys in the <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
// Token: 0x17000049 RID: 73
// (get) Token: 0x0600010B RID: 267 RVA: 0x000053F0 File Offset: 0x000035F0
public IList<TKey> Keys
{
get
{
return new SortedList<TKey, TValue>.ListKeys(this);
}
}
/// <summary>Gets a collection containing the values in the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>A <see cref="T:System.Collections.Generic.IList`1" /> containing the values in the <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
// Token: 0x1700004A RID: 74
// (get) Token: 0x0600010C RID: 268 RVA: 0x000053F8 File Offset: 0x000035F8
public IList<TValue> Values
{
get
{
return new SortedList<TKey, TValue>.ListValues(this);
}
}
/// <summary>Gets the <see cref="T:System.Collections.Generic.IComparer`1" /> for the sorted list. </summary>
/// <returns>The <see cref="T:System.IComparable`1" /> for the current <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
// Token: 0x1700004B RID: 75
// (get) Token: 0x0600010D RID: 269 RVA: 0x00005400 File Offset: 0x00003600
public IComparer<TKey> Comparer
{
get
{
return this.comparer;
}
}
/// <summary>Adds an element with the specified key and value into the <see cref="T:System.Collections.Generic.SortedList`2" />.</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 null for reference types.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">An element with the same key already exists in the <see cref="T:System.Collections.Generic.SortedList`2" />.</exception>
// Token: 0x0600010E RID: 270 RVA: 0x00005408 File Offset: 0x00003608
public void Add(TKey key, TValue value)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
this.PutImpl(key, value, false);
}
/// <summary>Determines whether the <see cref="T:System.Collections.Generic.SortedList`2" /> contains a specific key.</summary>
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedList`2" /> contains an element with the specified key; otherwise, false.</returns>
/// <param name="key">The key to locate in the <see cref="T:System.Collections.Generic.SortedList`2" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// Token: 0x0600010F RID: 271 RVA: 0x0000542C File Offset: 0x0000362C
public bool ContainsKey(TKey key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
return this.Find(key) >= 0;
}
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerator`1" /> of type <see cref="T:System.Collections.Generic.KeyValuePair`2" /> for the <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
// Token: 0x06000110 RID: 272 RVA: 0x00005454 File Offset: 0x00003654
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
{
for (int i = 0; i < this.inUse; i++)
{
KeyValuePair<TKey, TValue> current = this.table[i];
yield return new KeyValuePair<TKey, TValue>(current.Key, current.Value);
}
yield break;
}
/// <summary>Removes the element with the specified key from the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>true if the element is successfully removed; otherwise, false. This method also returns false if <paramref name="key" /> was not found in the original <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
/// <param name="key">The key of the element to remove.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// Token: 0x06000111 RID: 273 RVA: 0x00005470 File Offset: 0x00003670
public bool Remove(TKey key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
int num = this.IndexOfKey(key);
if (num >= 0)
{
this.RemoveAt(num);
return true;
}
return false;
}
/// <summary>Removes all elements from the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
// Token: 0x06000112 RID: 274 RVA: 0x000054AC File Offset: 0x000036AC
public void Clear()
{
this.defaultCapacity = SortedList<TKey, TValue>.INITIAL_SIZE;
this.table = new KeyValuePair<TKey, TValue>[this.defaultCapacity];
this.inUse = 0;
this.modificationCount++;
}
/// <summary>Removes the element at the specified index of the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <param name="index">The zero-based index of the element to remove.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero.-or-<paramref name="index" /> is equal to or greater than <see cref="P:System.Collections.Generic.SortedList`2.Count" />.</exception>
// Token: 0x06000113 RID: 275 RVA: 0x000054E0 File Offset: 0x000036E0
public void RemoveAt(int index)
{
KeyValuePair<TKey, TValue>[] array = this.table;
int count = this.Count;
if (index >= 0 && index < count)
{
if (index != count - 1)
{
Array.Copy(array, index + 1, array, index, count - 1 - index);
}
else
{
array[index] = default(KeyValuePair<TKey, TValue>);
}
this.inUse--;
this.modificationCount++;
return;
}
throw new ArgumentOutOfRangeException("index out of range");
}
/// <summary>Searches for the specified key and returns the zero-based index within the entire <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>The zero-based index of <paramref name="key" /> within the entire <see cref="T:System.Collections.Generic.SortedList`2" />, if found; otherwise, -1.</returns>
/// <param name="key">The key to locate in the <see cref="T:System.Collections.Generic.SortedList`2" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// Token: 0x06000114 RID: 276 RVA: 0x00005568 File Offset: 0x00003768
public int IndexOfKey(TKey key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
int num = 0;
try
{
num = this.Find(key);
}
catch (Exception)
{
throw new InvalidOperationException();
}
return num | (num >> 31);
}
/// <summary>Searches for the specified value and returns the zero-based index of the first occurrence within the entire <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>The zero-based index of the first occurrence of <paramref name="value" /> within the entire <see cref="T:System.Collections.Generic.SortedList`2" />, if found; otherwise, -1.</returns>
/// <param name="value">The value to locate in the <see cref="T:System.Collections.Generic.SortedList`2" />. The value can be null for reference types.</param>
// Token: 0x06000115 RID: 277 RVA: 0x000055C8 File Offset: 0x000037C8
public int IndexOfValue(TValue value)
{
if (this.inUse == 0)
{
return -1;
}
for (int i = 0; i < this.inUse; i++)
{
KeyValuePair<TKey, TValue> keyValuePair = this.table[i];
if (object.Equals(value, keyValuePair.Value))
{
return i;
}
}
return -1;
}
/// <summary>Determines whether the <see cref="T:System.Collections.Generic.SortedList`2" /> contains a specific value.</summary>
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedList`2" /> contains an element with the specified value; otherwise, false.</returns>
/// <param name="value">The value to locate in the <see cref="T:System.Collections.Generic.SortedList`2" />. The value can be null for reference types.</param>
// Token: 0x06000116 RID: 278 RVA: 0x0000562C File Offset: 0x0000382C
public bool ContainsValue(TValue value)
{
return this.IndexOfValue(value) >= 0;
}
/// <summary>Sets the capacity to the actual number of elements in the <see cref="T:System.Collections.Generic.SortedList`2" />, if that number is less than 90 percent of current capacity.</summary>
// Token: 0x06000117 RID: 279 RVA: 0x0000563C File Offset: 0x0000383C
public void TrimExcess()
{
if ((double)this.inUse < (double)this.table.Length * 0.9)
{
this.Capacity = this.inUse;
}
}
/// <summary>Gets the value associated with the specified key.</summary>
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedList`2" /> contains an element with the specified key; otherwise, false.</returns>
/// <param name="key">The key whose value to get.</param>
/// <param name="value">When this method returns, 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>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// Token: 0x06000118 RID: 280 RVA: 0x0000566C File Offset: 0x0000386C
public bool TryGetValue(TKey key, out TValue value)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
int num = this.Find(key);
if (num >= 0)
{
value = this.table[num].Value;
return true;
}
value = default(TValue);
return false;
}
// Token: 0x06000119 RID: 281 RVA: 0x000056C8 File Offset: 0x000038C8
private void EnsureCapacity(int n, int free)
{
KeyValuePair<TKey, TValue>[] array = this.table;
KeyValuePair<TKey, TValue>[] array2 = null;
int capacity = this.Capacity;
bool flag = free >= 0 && free < this.Count;
if (n > capacity)
{
array2 = new KeyValuePair<TKey, TValue>[n << 1];
}
if (array2 != null)
{
if (flag)
{
if (free > 0)
{
Array.Copy(array, 0, array2, 0, free);
}
int num = this.Count - free;
if (num > 0)
{
Array.Copy(array, free, array2, free + 1, num);
}
}
else
{
Array.Copy(array, array2, this.Count);
}
this.table = array2;
}
else if (flag)
{
Array.Copy(array, free, array, free + 1, this.Count - free);
}
}
// Token: 0x0600011A RID: 282 RVA: 0x00005784 File Offset: 0x00003984
private void PutImpl(TKey key, TValue value, bool overwrite)
{
if (key == null)
{
throw new ArgumentNullException("null key");
}
KeyValuePair<TKey, TValue>[] array = this.table;
int num = -1;
try
{
num = this.Find(key);
}
catch (Exception)
{
throw new InvalidOperationException();
}
if (num >= 0)
{
if (!overwrite)
{
throw new ArgumentException("element already exists");
}
array[num] = new KeyValuePair<TKey, TValue>(key, value);
this.modificationCount++;
return;
}
else
{
num = ~num;
if (num > this.Capacity + 1)
{
throw new Exception(string.Concat(new object[] { "SortedList::internal error (", key, ", ", value, ") at [", num, "]" }));
}
this.EnsureCapacity(this.Count + 1, num);
array = this.table;
array[num] = new KeyValuePair<TKey, TValue>(key, value);
this.inUse++;
this.modificationCount++;
return;
}
}
// Token: 0x0600011B RID: 283 RVA: 0x000058C4 File Offset: 0x00003AC4
private void Init(IComparer<TKey> comparer, int capacity, bool forceSize)
{
if (comparer == null)
{
comparer = Comparer<TKey>.Default;
}
this.comparer = comparer;
if (!forceSize && capacity < this.defaultCapacity)
{
capacity = this.defaultCapacity;
}
this.table = new KeyValuePair<TKey, TValue>[capacity];
this.inUse = 0;
this.modificationCount = 0;
}
// Token: 0x0600011C RID: 284 RVA: 0x0000591C File Offset: 0x00003B1C
private void CopyToArray(Array arr, int i, SortedList<TKey, TValue>.EnumeratorMode mode)
{
if (arr == null)
{
throw new ArgumentNullException("arr");
}
if (i < 0 || i + this.Count > arr.Length)
{
throw new ArgumentOutOfRangeException("i");
}
IEnumerator enumerator = new SortedList<TKey, TValue>.Enumerator(this, mode);
while (enumerator.MoveNext())
{
object obj = enumerator.Current;
arr.SetValue(obj, i++);
}
}
// Token: 0x0600011D RID: 285 RVA: 0x0000598C File Offset: 0x00003B8C
private int Find(TKey key)
{
KeyValuePair<TKey, TValue>[] array = this.table;
int count = this.Count;
if (count == 0)
{
return -1;
}
int i = 0;
int num = count - 1;
while (i <= num)
{
int num2 = i + num >> 1;
int num3 = this.comparer.Compare(array[num2].Key, key);
if (num3 == 0)
{
return num2;
}
if (num3 < 0)
{
i = num2 + 1;
}
else
{
num = num2 - 1;
}
}
return ~i;
}
// Token: 0x0600011E RID: 286 RVA: 0x00005A08 File Offset: 0x00003C08
private TKey ToKey(object key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
if (!(key is TKey))
{
throw new ArgumentException(string.Concat(new object[]
{
"The value \"",
key,
"\" isn't of type \"",
typeof(TKey),
"\" and can't be used in this generic collection."
}), "key");
}
return (TKey)((object)key);
}
// Token: 0x0600011F RID: 287 RVA: 0x00005A78 File Offset: 0x00003C78
private TValue ToValue(object value)
{
if (!(value is TValue))
{
throw new ArgumentException(string.Concat(new object[]
{
"The value \"",
value,
"\" isn't of type \"",
typeof(TValue),
"\" and can't be used in this generic collection."
}), "value");
}
return (TValue)((object)value);
}
// Token: 0x06000120 RID: 288 RVA: 0x00005AD8 File Offset: 0x00003CD8
internal TKey KeyAt(int index)
{
if (index >= 0 && index < this.Count)
{
return this.table[index].Key;
}
throw new ArgumentOutOfRangeException("Index out of range");
}
// Token: 0x06000121 RID: 289 RVA: 0x00005B0C File Offset: 0x00003D0C
internal TValue ValueAt(int index)
{
if (index >= 0 && index < this.Count)
{
return this.table[index].Value;
}
throw new ArgumentOutOfRangeException("Index out of range");
}
// Token: 0x04000057 RID: 87
private static readonly int INITIAL_SIZE = 16;
// Token: 0x04000058 RID: 88
private int inUse;
// Token: 0x04000059 RID: 89
private int modificationCount;
// Token: 0x0400005A RID: 90
private KeyValuePair<TKey, TValue>[] table;
// Token: 0x0400005B RID: 91
private IComparer<TKey> comparer;
// Token: 0x0400005C RID: 92
private int defaultCapacity;
// Token: 0x0200001D RID: 29
private enum EnumeratorMode
{
// Token: 0x0400005E RID: 94
KEY_MODE,
// Token: 0x0400005F RID: 95
VALUE_MODE,
// Token: 0x04000060 RID: 96
ENTRY_MODE
}
// Token: 0x0200001E RID: 30
private sealed class Enumerator : IEnumerator, IDictionaryEnumerator, ICloneable
{
// Token: 0x06000122 RID: 290 RVA: 0x00005B40 File Offset: 0x00003D40
public Enumerator(SortedList<TKey, TValue> host, SortedList<TKey, TValue>.EnumeratorMode mode)
{
this.host = host;
this.stamp = host.modificationCount;
this.size = host.Count;
this.mode = mode;
this.Reset();
}
// Token: 0x06000123 RID: 291 RVA: 0x00005B80 File Offset: 0x00003D80
public Enumerator(SortedList<TKey, TValue> host)
: this(host, SortedList<TKey, TValue>.EnumeratorMode.ENTRY_MODE)
{
}
// Token: 0x06000125 RID: 293 RVA: 0x00005B98 File Offset: 0x00003D98
public void Reset()
{
if (this.host.modificationCount != this.stamp || this.invalid)
{
throw new InvalidOperationException(SortedList<TKey, TValue>.Enumerator.xstr);
}
this.pos = -1;
this.currentKey = null;
this.currentValue = null;
}
// Token: 0x06000126 RID: 294 RVA: 0x00005BE8 File Offset: 0x00003DE8
public bool MoveNext()
{
if (this.host.modificationCount != this.stamp || this.invalid)
{
throw new InvalidOperationException(SortedList<TKey, TValue>.Enumerator.xstr);
}
KeyValuePair<TKey, TValue>[] table = this.host.table;
if (++this.pos < this.size)
{
KeyValuePair<TKey, TValue> keyValuePair = table[this.pos];
this.currentKey = keyValuePair.Key;
this.currentValue = keyValuePair.Value;
return true;
}
this.currentKey = null;
this.currentValue = null;
return false;
}
// Token: 0x1700004C RID: 76
// (get) Token: 0x06000127 RID: 295 RVA: 0x00005C90 File Offset: 0x00003E90
public DictionaryEntry Entry
{
get
{
if (this.invalid || this.pos >= this.size || this.pos == -1)
{
throw new InvalidOperationException(SortedList<TKey, TValue>.Enumerator.xstr);
}
return new DictionaryEntry(this.currentKey, this.currentValue);
}
}
// Token: 0x1700004D RID: 77
// (get) Token: 0x06000128 RID: 296 RVA: 0x00005CE4 File Offset: 0x00003EE4
public object Key
{
get
{
if (this.invalid || this.pos >= this.size || this.pos == -1)
{
throw new InvalidOperationException(SortedList<TKey, TValue>.Enumerator.xstr);
}
return this.currentKey;
}
}
// Token: 0x1700004E RID: 78
// (get) Token: 0x06000129 RID: 297 RVA: 0x00005D20 File Offset: 0x00003F20
public object Value
{
get
{
if (this.invalid || this.pos >= this.size || this.pos == -1)
{
throw new InvalidOperationException(SortedList<TKey, TValue>.Enumerator.xstr);
}
return this.currentValue;
}
}
// Token: 0x1700004F RID: 79
// (get) Token: 0x0600012A RID: 298 RVA: 0x00005D5C File Offset: 0x00003F5C
public object Current
{
get
{
if (this.invalid || this.pos >= this.size || this.pos == -1)
{
throw new InvalidOperationException(SortedList<TKey, TValue>.Enumerator.xstr);
}
switch (this.mode)
{
case SortedList<TKey, TValue>.EnumeratorMode.KEY_MODE:
return this.currentKey;
case SortedList<TKey, TValue>.EnumeratorMode.VALUE_MODE:
return this.currentValue;
case SortedList<TKey, TValue>.EnumeratorMode.ENTRY_MODE:
return this.Entry;
default:
throw new NotSupportedException(this.mode + " is not a supported mode.");
}
}
}
// Token: 0x0600012B RID: 299 RVA: 0x00005DF0 File Offset: 0x00003FF0
public object Clone()
{
return new SortedList<TKey, TValue>.Enumerator(this.host, this.mode)
{
stamp = this.stamp,
pos = this.pos,
size = this.size,
currentKey = this.currentKey,
currentValue = this.currentValue,
invalid = this.invalid
};
}
// Token: 0x04000061 RID: 97
private SortedList<TKey, TValue> host;
// Token: 0x04000062 RID: 98
private int stamp;
// Token: 0x04000063 RID: 99
private int pos;
// Token: 0x04000064 RID: 100
private int size;
// Token: 0x04000065 RID: 101
private SortedList<TKey, TValue>.EnumeratorMode mode;
// Token: 0x04000066 RID: 102
private object currentKey;
// Token: 0x04000067 RID: 103
private object currentValue;
// Token: 0x04000068 RID: 104
private bool invalid;
// Token: 0x04000069 RID: 105
private static readonly string xstr = "SortedList.Enumerator: snapshot out of sync.";
}
// Token: 0x0200001F RID: 31
[Serializable]
public struct KeyEnumerator : IEnumerator, IDisposable, IEnumerator<TKey>
{
// Token: 0x0600012C RID: 300 RVA: 0x00005E58 File Offset: 0x00004058
internal KeyEnumerator(SortedList<TKey, TValue> l)
{
this.l = l;
this.idx = -2;
this.ver = l.modificationCount;
}
// Token: 0x0600012D RID: 301 RVA: 0x00005E78 File Offset: 0x00004078
void IEnumerator.Reset()
{
if (this.ver != this.l.modificationCount)
{
throw new InvalidOperationException("Collection was modified after the enumerator was instantiated.");
}
this.idx = -2;
}
// Token: 0x17000050 RID: 80
// (get) Token: 0x0600012E RID: 302 RVA: 0x00005EA4 File Offset: 0x000040A4
object IEnumerator.Current
{
get
{
return this.Current;
}
}
// Token: 0x0600012F RID: 303 RVA: 0x00005EB4 File Offset: 0x000040B4
public void Dispose()
{
this.idx = -2;
}
// Token: 0x06000130 RID: 304 RVA: 0x00005EC0 File Offset: 0x000040C0
public bool MoveNext()
{
if (this.ver != this.l.modificationCount)
{
throw new InvalidOperationException("Collection was modified after the enumerator was instantiated.");
}
if (this.idx == -2)
{
this.idx = this.l.Count;
}
return this.idx != -1 && --this.idx != -1;
}
// Token: 0x17000051 RID: 81
// (get) Token: 0x06000131 RID: 305 RVA: 0x00005F34 File Offset: 0x00004134
public TKey Current
{
get
{
if (this.idx < 0)
{
throw new InvalidOperationException();
}
return this.l.KeyAt(this.l.Count - 1 - this.idx);
}
}
// Token: 0x0400006A RID: 106
private const int NOT_STARTED = -2;
// Token: 0x0400006B RID: 107
private const int FINISHED = -1;
// Token: 0x0400006C RID: 108
private SortedList<TKey, TValue> l;
// Token: 0x0400006D RID: 109
private int idx;
// Token: 0x0400006E RID: 110
private int ver;
}
// Token: 0x02000020 RID: 32
[Serializable]
public struct ValueEnumerator : IEnumerator, IDisposable, IEnumerator<TValue>
{
// Token: 0x06000132 RID: 306 RVA: 0x00005F68 File Offset: 0x00004168
internal ValueEnumerator(SortedList<TKey, TValue> l)
{
this.l = l;
this.idx = -2;
this.ver = l.modificationCount;
}
// Token: 0x06000133 RID: 307 RVA: 0x00005F88 File Offset: 0x00004188
void IEnumerator.Reset()
{
if (this.ver != this.l.modificationCount)
{
throw new InvalidOperationException("Collection was modified after the enumerator was instantiated.");
}
this.idx = -2;
}
// Token: 0x17000052 RID: 82
// (get) Token: 0x06000134 RID: 308 RVA: 0x00005FB4 File Offset: 0x000041B4
object IEnumerator.Current
{
get
{
return this.Current;
}
}
// Token: 0x06000135 RID: 309 RVA: 0x00005FC4 File Offset: 0x000041C4
public void Dispose()
{
this.idx = -2;
}
// Token: 0x06000136 RID: 310 RVA: 0x00005FD0 File Offset: 0x000041D0
public bool MoveNext()
{
if (this.ver != this.l.modificationCount)
{
throw new InvalidOperationException("Collection was modified after the enumerator was instantiated.");
}
if (this.idx == -2)
{
this.idx = this.l.Count;
}
return this.idx != -1 && --this.idx != -1;
}
// Token: 0x17000053 RID: 83
// (get) Token: 0x06000137 RID: 311 RVA: 0x00006044 File Offset: 0x00004244
public TValue Current
{
get
{
if (this.idx < 0)
{
throw new InvalidOperationException();
}
return this.l.ValueAt(this.l.Count - 1 - this.idx);
}
}
// Token: 0x0400006F RID: 111
private const int NOT_STARTED = -2;
// Token: 0x04000070 RID: 112
private const int FINISHED = -1;
// Token: 0x04000071 RID: 113
private SortedList<TKey, TValue> l;
// Token: 0x04000072 RID: 114
private int idx;
// Token: 0x04000073 RID: 115
private int ver;
}
// Token: 0x02000021 RID: 33
private class ListKeys : ICollection, IEnumerable, IList<TKey>, ICollection<TKey>, IEnumerable<TKey>
{
// Token: 0x06000138 RID: 312 RVA: 0x00006078 File Offset: 0x00004278
public ListKeys(SortedList<TKey, TValue> host)
{
if (host == null)
{
throw new ArgumentNullException();
}
this.host = host;
}
// Token: 0x06000139 RID: 313 RVA: 0x00006094 File Offset: 0x00004294
IEnumerator IEnumerable.GetEnumerator()
{
for (int i = 0; i < this.host.Count; i++)
{
yield return this.host.KeyAt(i);
}
yield break;
}
// Token: 0x0600013A RID: 314 RVA: 0x000060B0 File Offset: 0x000042B0
public virtual void Add(TKey item)
{
throw new NotSupportedException();
}
// Token: 0x0600013B RID: 315 RVA: 0x000060B8 File Offset: 0x000042B8
public virtual bool Remove(TKey key)
{
throw new NotSupportedException();
}
// Token: 0x0600013C RID: 316 RVA: 0x000060C0 File Offset: 0x000042C0
public virtual void Clear()
{
throw new NotSupportedException();
}
// Token: 0x0600013D RID: 317 RVA: 0x000060C8 File Offset: 0x000042C8
public virtual void CopyTo(TKey[] array, int arrayIndex)
{
if (this.host.Count == 0)
{
return;
}
if (array == null)
{
throw new ArgumentNullException("array");
}
if (arrayIndex < 0)
{
throw new ArgumentOutOfRangeException();
}
if (arrayIndex >= array.Length)
{
throw new ArgumentOutOfRangeException("arrayIndex is greater than or equal to array.Length");
}
if (this.Count > array.Length - arrayIndex)
{
throw new ArgumentOutOfRangeException("Not enough space in array from arrayIndex to end of array");
}
int num = arrayIndex;
for (int i = 0; i < this.Count; i++)
{
array[num++] = this.host.KeyAt(i);
}
}
// Token: 0x0600013E RID: 318 RVA: 0x00006164 File Offset: 0x00004364
public virtual bool Contains(TKey item)
{
return this.host.IndexOfKey(item) > -1;
}
// Token: 0x0600013F RID: 319 RVA: 0x00006178 File Offset: 0x00004378
public virtual int IndexOf(TKey item)
{
return this.host.IndexOfKey(item);
}
// Token: 0x06000140 RID: 320 RVA: 0x00006188 File Offset: 0x00004388
public virtual void Insert(int index, TKey item)
{
throw new NotSupportedException();
}
// Token: 0x06000141 RID: 321 RVA: 0x00006190 File Offset: 0x00004390
public virtual void RemoveAt(int index)
{
throw new NotSupportedException();
}
// Token: 0x17000054 RID: 84
public virtual TKey this[int index]
{
get
{
return this.host.KeyAt(index);
}
set
{
throw new NotSupportedException("attempt to modify a key");
}
}
// Token: 0x06000144 RID: 324 RVA: 0x000061B4 File Offset: 0x000043B4
public virtual IEnumerator<TKey> GetEnumerator()
{
return new SortedList<TKey, TValue>.KeyEnumerator(this.host);
}
// Token: 0x17000055 RID: 85
// (get) Token: 0x06000145 RID: 325 RVA: 0x000061C8 File Offset: 0x000043C8
public virtual int Count
{
get
{
return this.host.Count;
}
}
// Token: 0x17000056 RID: 86
// (get) Token: 0x06000146 RID: 326 RVA: 0x000061D8 File Offset: 0x000043D8
public virtual bool IsSynchronized
{
get
{
return ((ICollection)this.host).IsSynchronized;
}
}
// Token: 0x17000057 RID: 87
// (get) Token: 0x06000147 RID: 327 RVA: 0x000061E8 File Offset: 0x000043E8
public virtual bool IsReadOnly
{
get
{
return true;
}
}
// Token: 0x17000058 RID: 88
// (get) Token: 0x06000148 RID: 328 RVA: 0x000061EC File Offset: 0x000043EC
public virtual object SyncRoot
{
get
{
return ((ICollection)this.host).SyncRoot;
}
}
// Token: 0x06000149 RID: 329 RVA: 0x000061FC File Offset: 0x000043FC
public virtual void CopyTo(Array array, int arrayIndex)
{
this.host.CopyToArray(array, arrayIndex, SortedList<TKey, TValue>.EnumeratorMode.KEY_MODE);
}
// Token: 0x04000074 RID: 116
private SortedList<TKey, TValue> host;
}
// Token: 0x02000022 RID: 34
private class ListValues : ICollection, IEnumerable, IList<TValue>, ICollection<TValue>, IEnumerable<TValue>
{
// Token: 0x0600014A RID: 330 RVA: 0x0000620C File Offset: 0x0000440C
public ListValues(SortedList<TKey, TValue> host)
{
if (host == null)
{
throw new ArgumentNullException();
}
this.host = host;
}
// Token: 0x0600014B RID: 331 RVA: 0x00006228 File Offset: 0x00004428
IEnumerator IEnumerable.GetEnumerator()
{
for (int i = 0; i < this.host.Count; i++)
{
yield return this.host.ValueAt(i);
}
yield break;
}
// Token: 0x0600014C RID: 332 RVA: 0x00006244 File Offset: 0x00004444
public virtual void Add(TValue item)
{
throw new NotSupportedException();
}
// Token: 0x0600014D RID: 333 RVA: 0x0000624C File Offset: 0x0000444C
public virtual bool Remove(TValue value)
{
throw new NotSupportedException();
}
// Token: 0x0600014E RID: 334 RVA: 0x00006254 File Offset: 0x00004454
public virtual void Clear()
{
throw new NotSupportedException();
}
// Token: 0x0600014F RID: 335 RVA: 0x0000625C File Offset: 0x0000445C
public virtual void CopyTo(TValue[] array, int arrayIndex)
{
if (this.host.Count == 0)
{
return;
}
if (array == null)
{
throw new ArgumentNullException("array");
}
if (arrayIndex < 0)
{
throw new ArgumentOutOfRangeException();
}
if (arrayIndex >= array.Length)
{
throw new ArgumentOutOfRangeException("arrayIndex is greater than or equal to array.Length");
}
if (this.Count > array.Length - arrayIndex)
{
throw new ArgumentOutOfRangeException("Not enough space in array from arrayIndex to end of array");
}
int num = arrayIndex;
for (int i = 0; i < this.Count; i++)
{
array[num++] = this.host.ValueAt(i);
}
}
// Token: 0x06000150 RID: 336 RVA: 0x000062F8 File Offset: 0x000044F8
public virtual bool Contains(TValue item)
{
return this.host.IndexOfValue(item) > -1;
}
// Token: 0x06000151 RID: 337 RVA: 0x0000630C File Offset: 0x0000450C
public virtual int IndexOf(TValue item)
{
return this.host.IndexOfValue(item);
}
// Token: 0x06000152 RID: 338 RVA: 0x0000631C File Offset: 0x0000451C
public virtual void Insert(int index, TValue item)
{
throw new NotSupportedException();
}
// Token: 0x06000153 RID: 339 RVA: 0x00006324 File Offset: 0x00004524
public virtual void RemoveAt(int index)
{
throw new NotSupportedException();
}
// Token: 0x17000059 RID: 89
public virtual TValue this[int index]
{
get
{
return this.host.ValueAt(index);
}
set
{
throw new NotSupportedException("attempt to modify a key");
}
}
// Token: 0x06000156 RID: 342 RVA: 0x00006348 File Offset: 0x00004548
public virtual IEnumerator<TValue> GetEnumerator()
{
return new SortedList<TKey, TValue>.ValueEnumerator(this.host);
}
// Token: 0x1700005A RID: 90
// (get) Token: 0x06000157 RID: 343 RVA: 0x0000635C File Offset: 0x0000455C
public virtual int Count
{
get
{
return this.host.Count;
}
}
// Token: 0x1700005B RID: 91
// (get) Token: 0x06000158 RID: 344 RVA: 0x0000636C File Offset: 0x0000456C
public virtual bool IsSynchronized
{
get
{
return ((ICollection)this.host).IsSynchronized;
}
}
// Token: 0x1700005C RID: 92
// (get) Token: 0x06000159 RID: 345 RVA: 0x0000637C File Offset: 0x0000457C
public virtual bool IsReadOnly
{
get
{
return true;
}
}
// Token: 0x1700005D RID: 93
// (get) Token: 0x0600015A RID: 346 RVA: 0x00006380 File Offset: 0x00004580
public virtual object SyncRoot
{
get
{
return ((ICollection)this.host).SyncRoot;
}
}
// Token: 0x0600015B RID: 347 RVA: 0x00006390 File Offset: 0x00004590
public virtual void CopyTo(Array array, int arrayIndex)
{
this.host.CopyToArray(array, arrayIndex, SortedList<TKey, TValue>.EnumeratorMode.VALUE_MODE);
}
// Token: 0x04000075 RID: 117
private SortedList<TKey, TValue> host;
}
}
}