This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,422 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace System.Collections.ObjectModel
{
/// <summary>Provides the base class for a generic collection.</summary>
/// <typeparam name="T">The type of elements in the collection.</typeparam>
// Token: 0x02000110 RID: 272
[ComVisible(false)]
[Serializable]
public class Collection<T> : IEnumerable, ICollection, IList, ICollection<T>, IList<T>, IEnumerable<T>
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.ObjectModel.Collection`1" /> class that is empty.</summary>
// Token: 0x06000D65 RID: 3429 RVA: 0x0003B278 File Offset: 0x00039478
public Collection()
{
List<T> list = new List<T>();
IList list2 = list;
this.syncRoot = list2.SyncRoot;
this.list = list;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.ObjectModel.Collection`1" /> class as a wrapper for the specified list.</summary>
/// <param name="list">The list that is wrapped by the new collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="list" /> is null.</exception>
// Token: 0x06000D66 RID: 3430 RVA: 0x0003B2A8 File Offset: 0x000394A8
public Collection(IList<T> list)
{
if (list == null)
{
throw new ArgumentNullException("list");
}
this.list = list;
ICollection collection = list as ICollection;
this.syncRoot = ((collection == null) ? new object() : collection.SyncRoot);
}
// Token: 0x170001FF RID: 511
// (get) Token: 0x06000D67 RID: 3431 RVA: 0x0003B2F8 File Offset: 0x000394F8
bool ICollection<T>.IsReadOnly
{
get
{
return this.list.IsReadOnly;
}
}
/// <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 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: 0x06000D68 RID: 3432 RVA: 0x0003B308 File Offset: 0x00039508
void ICollection.CopyTo(Array array, int index)
{
((ICollection)this.list).CopyTo(array, index);
}
/// <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: 0x06000D69 RID: 3433 RVA: 0x0003B31C File Offset: 0x0003951C
IEnumerator IEnumerable.GetEnumerator()
{
return this.list.GetEnumerator();
}
/// <summary>Adds an item to the <see cref="T:System.Collections.IList" />.</summary>
/// <returns>The position into which the new element was inserted.</returns>
/// <param name="value">The <see cref="T:System.Object" /> to add to the <see cref="T:System.Collections.IList" />.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
// Token: 0x06000D6A RID: 3434 RVA: 0x0003B32C File Offset: 0x0003952C
int IList.Add(object value)
{
int count = this.list.Count;
this.InsertItem(count, Collection<T>.ConvertItem(value));
return count;
}
/// <summary>Determines whether the <see cref="T:System.Collections.IList" /> contains a specific value.</summary>
/// <returns>true if the <see cref="T:System.Object" /> is found in the <see cref="T:System.Collections.IList" />; otherwise, false.</returns>
/// <param name="value">The <see cref="T:System.Object" /> to locate in the <see cref="T:System.Collections.IList" />.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
// Token: 0x06000D6B RID: 3435 RVA: 0x0003B354 File Offset: 0x00039554
bool IList.Contains(object value)
{
return Collection<T>.IsValidItem(value) && this.list.Contains((T)((object)value));
}
/// <summary>Determines the index of a specific item in the <see cref="T:System.Collections.IList" />.</summary>
/// <returns>The index of <paramref name="value" /> if found in the list; otherwise, -1.</returns>
/// <param name="value">The <see cref="T:System.Object" /> to locate in the <see cref="T:System.Collections.IList" />.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
// Token: 0x06000D6C RID: 3436 RVA: 0x0003B374 File Offset: 0x00039574
int IList.IndexOf(object value)
{
if (Collection<T>.IsValidItem(value))
{
return this.list.IndexOf((T)((object)value));
}
return -1;
}
/// <summary>Inserts an item into the <see cref="T:System.Collections.IList" /> at the specified index.</summary>
/// <param name="index">The zero-based index at which <paramref name="value" /> should be inserted.</param>
/// <param name="value">The <see cref="T:System.Object" /> to insert into the <see cref="T:System.Collections.IList" />.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is not a valid index in the <see cref="T:System.Collections.IList" />. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
// Token: 0x06000D6D RID: 3437 RVA: 0x0003B394 File Offset: 0x00039594
void IList.Insert(int index, object value)
{
this.InsertItem(index, Collection<T>.ConvertItem(value));
}
/// <summary>Removes the first occurrence of a specific object from the <see cref="T:System.Collections.IList" />.</summary>
/// <param name="value">The <see cref="T:System.Object" /> to remove from the <see cref="T:System.Collections.IList" />.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
// Token: 0x06000D6E RID: 3438 RVA: 0x0003B3A4 File Offset: 0x000395A4
void IList.Remove(object value)
{
Collection<T>.CheckWritable(this.list);
int num = this.IndexOf(Collection<T>.ConvertItem(value));
this.RemoveItem(num);
}
/// <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.ObjectModel.Collection`1" />, this property always returns false.</returns>
// Token: 0x17000200 RID: 512
// (get) Token: 0x06000D6F RID: 3439 RVA: 0x0003B3D0 File Offset: 0x000395D0
bool ICollection.IsSynchronized
{
get
{
return Collection<T>.IsSynchronized(this.list);
}
}
/// <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.ObjectModel.Collection`1" />, this property always returns the current instance.</returns>
// Token: 0x17000201 RID: 513
// (get) Token: 0x06000D70 RID: 3440 RVA: 0x0003B3E0 File Offset: 0x000395E0
object ICollection.SyncRoot
{
get
{
return this.syncRoot;
}
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IList" /> has a fixed size.</summary>
/// <returns>true if the <see cref="T:System.Collections.IList" /> has a fixed size; otherwise, false. In the default implementation of <see cref="T:System.Collections.ObjectModel.Collection`1" />, this property always returns false.</returns>
// Token: 0x17000202 RID: 514
// (get) Token: 0x06000D71 RID: 3441 RVA: 0x0003B3E8 File Offset: 0x000395E8
bool IList.IsFixedSize
{
get
{
return Collection<T>.IsFixedSize(this.list);
}
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IList" /> is read-only.</summary>
/// <returns>true if the <see cref="T:System.Collections.IList" /> is read-only; otherwise, false. In the default implementation of <see cref="T:System.Collections.ObjectModel.Collection`1" />, this property always returns false.</returns>
// Token: 0x17000203 RID: 515
// (get) Token: 0x06000D72 RID: 3442 RVA: 0x0003B3F8 File Offset: 0x000395F8
bool IList.IsReadOnly
{
get
{
return this.list.IsReadOnly;
}
}
/// <summary>Gets or sets the element at the specified index.</summary>
/// <returns>The element at the specified index.</returns>
/// <param name="index">The zero-based index of the element to get or set.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is not a valid index in the <see cref="T:System.Collections.IList" />.</exception>
/// <exception cref="T:System.ArgumentException">The property is set, and <paramref name="index" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
// Token: 0x17000204 RID: 516
object IList.this[int index]
{
get
{
return this.list[index];
}
set
{
this.SetItem(index, Collection<T>.ConvertItem(value));
}
}
/// <summary>Adds an object to the end of the <see cref="T:System.Collections.ObjectModel.Collection`1" />. </summary>
/// <param name="item">The object to be added to the end of the <see cref="T:System.Collections.ObjectModel.Collection`1" />. The value can be null for reference types.</param>
// Token: 0x06000D75 RID: 3445 RVA: 0x0003B42C File Offset: 0x0003962C
public void Add(T item)
{
int count = this.list.Count;
this.InsertItem(count, item);
}
/// <summary>Removes all elements from the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
// Token: 0x06000D76 RID: 3446 RVA: 0x0003B450 File Offset: 0x00039650
public void Clear()
{
this.ClearItems();
}
/// <summary>Removes all elements from the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
// Token: 0x06000D77 RID: 3447 RVA: 0x0003B458 File Offset: 0x00039658
protected virtual void ClearItems()
{
this.list.Clear();
}
/// <summary>Determines whether an element is in the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
/// <returns>true if <paramref name="item" /> is found in the <see cref="T:System.Collections.ObjectModel.Collection`1" />; otherwise, false.</returns>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.ObjectModel.Collection`1" />. The value can be null for reference types.</param>
// Token: 0x06000D78 RID: 3448 RVA: 0x0003B468 File Offset: 0x00039668
public bool Contains(T item)
{
return this.list.Contains(item);
}
/// <summary>Copies the entire <see cref="T:System.Collections.ObjectModel.Collection`1" /> to a compatible one-dimensional <see cref="T:System.Array" />, starting at the specified index of the target array.</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.ObjectModel.Collection`1" />. 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 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.ObjectModel.Collection`1" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
// Token: 0x06000D79 RID: 3449 RVA: 0x0003B478 File Offset: 0x00039678
public void CopyTo(T[] array, int index)
{
this.list.CopyTo(array, index);
}
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerator`1" /> for the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</returns>
// Token: 0x06000D7A RID: 3450 RVA: 0x0003B488 File Offset: 0x00039688
public IEnumerator<T> GetEnumerator()
{
return this.list.GetEnumerator();
}
/// <summary>Searches for the specified object and returns the zero-based index of the first occurrence within the entire <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
/// <returns>The zero-based index of the first occurrence of <paramref name="item" /> within the entire <see cref="T:System.Collections.ObjectModel.Collection`1" />, if found; otherwise, -1.</returns>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.List`1" />. The value can be null for reference types.</param>
// Token: 0x06000D7B RID: 3451 RVA: 0x0003B498 File Offset: 0x00039698
public int IndexOf(T item)
{
return this.list.IndexOf(item);
}
/// <summary>Inserts an element into the <see cref="T:System.Collections.ObjectModel.Collection`1" /> at the specified index.</summary>
/// <param name="index">The zero-based index at which <paramref name="item" /> should be inserted.</param>
/// <param name="item">The object to insert. The value can be null for reference types.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero.-or-<paramref name="index" /> is greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count" />.</exception>
// Token: 0x06000D7C RID: 3452 RVA: 0x0003B4A8 File Offset: 0x000396A8
public void Insert(int index, T item)
{
this.InsertItem(index, item);
}
/// <summary>Inserts an element into the <see cref="T:System.Collections.ObjectModel.Collection`1" /> at the specified index.</summary>
/// <param name="index">The zero-based index at which <paramref name="item" /> should be inserted.</param>
/// <param name="item">The object to insert. The value can be null for reference types.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero.-or-<paramref name="index" /> is greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count" />.</exception>
// Token: 0x06000D7D RID: 3453 RVA: 0x0003B4B4 File Offset: 0x000396B4
protected virtual void InsertItem(int index, T item)
{
this.list.Insert(index, item);
}
/// <summary>Gets a <see cref="T:System.Collections.Generic.IList`1" /> wrapper around the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
/// <returns>A <see cref="T:System.Collections.Generic.IList`1" /> wrapper around the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</returns>
// Token: 0x17000205 RID: 517
// (get) Token: 0x06000D7E RID: 3454 RVA: 0x0003B4C4 File Offset: 0x000396C4
protected IList<T> Items
{
get
{
return this.list;
}
}
/// <summary>Removes the first occurrence of a specific object from the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
/// <returns>true if <paramref name="item" /> is successfully removed; otherwise, false. This method also returns false if <paramref name="item" /> was not found in the original <see cref="T:System.Collections.ObjectModel.Collection`1" />.</returns>
/// <param name="item">The object to remove from the <see cref="T:System.Collections.ObjectModel.Collection`1" />. The value can be null for reference types.</param>
// Token: 0x06000D7F RID: 3455 RVA: 0x0003B4CC File Offset: 0x000396CC
public bool Remove(T item)
{
int num = this.IndexOf(item);
if (num == -1)
{
return false;
}
this.RemoveItem(num);
return true;
}
/// <summary>Removes the element at the specified index of the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</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.ObjectModel.Collection`1.Count" />.</exception>
// Token: 0x06000D80 RID: 3456 RVA: 0x0003B4F4 File Offset: 0x000396F4
public void RemoveAt(int index)
{
this.RemoveItem(index);
}
/// <summary>Removes the element at the specified index of the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</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.ObjectModel.Collection`1.Count" />.</exception>
// Token: 0x06000D81 RID: 3457 RVA: 0x0003B500 File Offset: 0x00039700
protected virtual void RemoveItem(int index)
{
this.list.RemoveAt(index);
}
/// <summary>Gets the number of elements actually contained in the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
/// <returns>The number of elements actually contained in the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</returns>
// Token: 0x17000206 RID: 518
// (get) Token: 0x06000D82 RID: 3458 RVA: 0x0003B510 File Offset: 0x00039710
public int Count
{
get
{
return this.list.Count;
}
}
/// <summary>Gets or sets the element at the specified index.</summary>
/// <returns>The element at the specified index.</returns>
/// <param name="index">The zero-based index of the element to get or set.</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.ObjectModel.Collection`1.Count" />. </exception>
// Token: 0x17000207 RID: 519
public T this[int index]
{
get
{
return this.list[index];
}
set
{
this.SetItem(index, value);
}
}
/// <summary>Replaces the element at the specified index.</summary>
/// <param name="index">The zero-based index of the element to replace.</param>
/// <param name="item">The new value for the element at the specified index. The value can be null for reference types.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero.-or-<paramref name="index" /> is greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count" />.</exception>
// Token: 0x06000D85 RID: 3461 RVA: 0x0003B53C File Offset: 0x0003973C
protected virtual void SetItem(int index, T item)
{
this.list[index] = item;
}
// Token: 0x06000D86 RID: 3462 RVA: 0x0003B54C File Offset: 0x0003974C
internal static bool IsValidItem(object item)
{
return item is T || (item == null && !typeof(T).IsValueType);
}
// Token: 0x06000D87 RID: 3463 RVA: 0x0003B578 File Offset: 0x00039778
internal static T ConvertItem(object item)
{
if (Collection<T>.IsValidItem(item))
{
return (T)((object)item);
}
throw new ArgumentException("item");
}
// Token: 0x06000D88 RID: 3464 RVA: 0x0003B598 File Offset: 0x00039798
internal static void CheckWritable(IList<T> list)
{
if (list.IsReadOnly)
{
throw new NotSupportedException();
}
}
// Token: 0x06000D89 RID: 3465 RVA: 0x0003B5AC File Offset: 0x000397AC
internal static bool IsSynchronized(IList<T> list)
{
ICollection collection = list as ICollection;
return collection != null && collection.IsSynchronized;
}
// Token: 0x06000D8A RID: 3466 RVA: 0x0003B5D4 File Offset: 0x000397D4
internal static bool IsFixedSize(IList<T> list)
{
IList list2 = list as IList;
return list2 != null && list2.IsFixedSize;
}
// Token: 0x04000387 RID: 903
private IList<T> list;
// Token: 0x04000388 RID: 904
private object syncRoot;
}
}
@@ -0,0 +1,281 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace System.Collections.ObjectModel
{
/// <summary>Provides the abstract base class for a collection whose keys are embedded in the values.</summary>
/// <typeparam name="TKey">The type of keys in the collection.</typeparam>
/// <typeparam name="TItem">The type of items in the collection.</typeparam>
// Token: 0x02000111 RID: 273
[ComVisible(false)]
[Serializable]
public abstract class KeyedCollection<TKey, TItem> : Collection<TItem>
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> class that uses the default equality comparer.</summary>
// Token: 0x06000D8B RID: 3467 RVA: 0x0003B5FC File Offset: 0x000397FC
protected KeyedCollection()
: this(null, 0)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> class that uses the specified equality comparer.</summary>
/// <param name="comparer">The implementation of the <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> generic interface to use when comparing keys, or null to use the default equality comparer for the type of the key, obtained from <see cref="P:System.Collections.Generic.EqualityComparer`1.Default" />.</param>
// Token: 0x06000D8C RID: 3468 RVA: 0x0003B608 File Offset: 0x00039808
protected KeyedCollection(IEqualityComparer<TKey> comparer)
: this(comparer, 0)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> class that uses the specified equality comparer and creates a lookup dictionary when the specified threshold is exceeded.</summary>
/// <param name="comparer">The implementation of the <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> generic interface to use when comparing keys, or null to use the default equality comparer for the type of the key, obtained from <see cref="P:System.Collections.Generic.EqualityComparer`1.Default" />.</param>
/// <param name="dictionaryCreationThreshold">The number of elements the collection can hold without creating a lookup dictionary (0 creates the lookup dictionary when the first item is added), or 1 to specify that a lookup dictionary is never created.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="dictionaryCreationThreshold" /> is less than 1.</exception>
// Token: 0x06000D8D RID: 3469 RVA: 0x0003B614 File Offset: 0x00039814
protected KeyedCollection(IEqualityComparer<TKey> comparer, int dictionaryCreationThreshold)
{
if (comparer != null)
{
this.comparer = comparer;
}
else
{
this.comparer = EqualityComparer<TKey>.Default;
}
this.dictionaryCreationThreshold = dictionaryCreationThreshold;
if (dictionaryCreationThreshold == 0)
{
this.dictionary = new Dictionary<TKey, TItem>(this.comparer);
}
}
/// <summary>Determines whether the collection contains an element with the specified key.</summary>
/// <returns>true if the <see cref="T:System.Collections.ObjectModel.KeyedCollection`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.ObjectModel.KeyedCollection`2" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// Token: 0x06000D8E RID: 3470 RVA: 0x0003B664 File Offset: 0x00039864
public bool Contains(TKey key)
{
if (this.dictionary != null)
{
return this.dictionary.ContainsKey(key);
}
return this.IndexOfKey(key) >= 0;
}
// Token: 0x06000D8F RID: 3471 RVA: 0x0003B68C File Offset: 0x0003988C
private int IndexOfKey(TKey key)
{
for (int i = this.Count - 1; i >= 0; i--)
{
TKey keyForItem = this.GetKeyForItem(this[i]);
if (this.comparer.Equals(key, keyForItem))
{
return i;
}
}
return -1;
}
/// <summary>Removes the element with the specified key from the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />.</summary>
/// <returns>true if the element is successfully removed; otherwise, false. This method also returns false if <paramref name="key" /> is not found in the <see cref="T:System.Collections.ObjectModel.KeyedCollection`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: 0x06000D90 RID: 3472 RVA: 0x0003B6D8 File Offset: 0x000398D8
public bool Remove(TKey key)
{
if (this.dictionary != null)
{
TItem titem;
return this.dictionary.TryGetValue(key, out titem) && base.Remove(titem);
}
int num = this.IndexOfKey(key);
if (num == -1)
{
return false;
}
this.RemoveAt(num);
return true;
}
/// <summary>Gets the generic equality comparer that is used to determine equality of keys in the collection.</summary>
/// <returns>The implementation of the <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> generic interface that is used to determine equality of keys in the collection.</returns>
// Token: 0x17000208 RID: 520
// (get) Token: 0x06000D91 RID: 3473 RVA: 0x0003B728 File Offset: 0x00039928
public IEqualityComparer<TKey> Comparer
{
get
{
return this.comparer;
}
}
/// <summary>Gets the element with the specified key. </summary>
/// <returns>The element with the specified key. If an element with the specified key is not found, an exception is thrown.</returns>
/// <param name="key">The key of the element to get.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
/// <exception cref="T:System.Collections.Generic.KeyNotFoundException">An element with the specified key does not exist in the collection.</exception>
// Token: 0x17000209 RID: 521
public TItem this[TKey key]
{
get
{
if (this.dictionary != null)
{
return this.dictionary[key];
}
int num = this.IndexOfKey(key);
if (num >= 0)
{
return base[num];
}
throw new KeyNotFoundException();
}
}
/// <summary>Changes the key associated with the specified element in the lookup dictionary.</summary>
/// <param name="item">The element to change the key of.</param>
/// <param name="newKey">The new key for <paramref name="item" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="item" /> is null.-or-<paramref name="key" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="item" /> is not found.-or-<paramref name="key" /> already exists in the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />.</exception>
// Token: 0x06000D93 RID: 3475 RVA: 0x0003B774 File Offset: 0x00039974
protected void ChangeItemKey(TItem item, TKey newKey)
{
if (!this.Contains(item))
{
throw new ArgumentException();
}
TKey keyForItem = this.GetKeyForItem(item);
if (this.comparer.Equals(keyForItem, newKey))
{
return;
}
if (this.Contains(newKey))
{
throw new ArgumentException();
}
if (this.dictionary != null)
{
if (!this.dictionary.Remove(keyForItem))
{
throw new ArgumentException();
}
this.dictionary.Add(newKey, item);
}
}
/// <summary>Removes all elements from the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />.</summary>
// Token: 0x06000D94 RID: 3476 RVA: 0x0003B7F0 File Offset: 0x000399F0
protected override void ClearItems()
{
if (this.dictionary != null)
{
this.dictionary.Clear();
}
base.ClearItems();
}
/// <summary>When implemented in a derived class, extracts the key from the specified element.</summary>
/// <returns>The key for the specified element.</returns>
/// <param name="item">The element from which to extract the key.</param>
// Token: 0x06000D95 RID: 3477
protected abstract TKey GetKeyForItem(TItem item);
/// <summary>Inserts an element into the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> at the specified index.</summary>
/// <param name="index">The zero-based index at which <paramref name="item" /> should be inserted.</param>
/// <param name="item">The object to insert.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.-or-<paramref name="index" /> is greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count" />.</exception>
// Token: 0x06000D96 RID: 3478 RVA: 0x0003B810 File Offset: 0x00039A10
protected override void InsertItem(int index, TItem item)
{
TKey keyForItem = this.GetKeyForItem(item);
if (keyForItem == null)
{
throw new ArgumentNullException("GetKeyForItem(item)");
}
if (this.dictionary != null && this.dictionary.ContainsKey(keyForItem))
{
throw new ArgumentException("An element with the same key already exists in the dictionary.");
}
if (this.dictionary == null)
{
for (int i = 0; i < this.Count; i++)
{
if (this.comparer.Equals(keyForItem, this.GetKeyForItem(this[i])))
{
throw new ArgumentException("An element with the same key already exists in the dictionary.");
}
}
}
base.InsertItem(index, item);
if (this.dictionary != null)
{
this.dictionary.Add(keyForItem, item);
}
else if (this.dictionaryCreationThreshold != -1 && this.Count > this.dictionaryCreationThreshold)
{
this.dictionary = new Dictionary<TKey, TItem>(this.comparer);
for (int j = 0; j < this.Count; j++)
{
TItem titem = this[j];
this.dictionary.Add(this.GetKeyForItem(titem), titem);
}
}
}
/// <summary>Removes the element at the specified index of the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />.</summary>
/// <param name="index">The index of the element to remove.</param>
// Token: 0x06000D97 RID: 3479 RVA: 0x0003B934 File Offset: 0x00039B34
protected override void RemoveItem(int index)
{
if (this.dictionary != null)
{
TKey keyForItem = this.GetKeyForItem(this[index]);
this.dictionary.Remove(keyForItem);
}
base.RemoveItem(index);
}
/// <summary>Replaces the item at the specified index with the specified item.</summary>
/// <param name="index">The zero-based index of the item to be replaced.</param>
/// <param name="item">The new item.</param>
// Token: 0x06000D98 RID: 3480 RVA: 0x0003B970 File Offset: 0x00039B70
protected override void SetItem(int index, TItem item)
{
if (this.dictionary != null)
{
this.dictionary.Remove(this.GetKeyForItem(this[index]));
this.dictionary.Add(this.GetKeyForItem(item), item);
}
base.SetItem(index, item);
}
/// <summary>Gets the lookup dictionary of the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />.</summary>
/// <returns>The lookup dictionary of the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />, if it exists; otherwise, null.</returns>
// Token: 0x1700020A RID: 522
// (get) Token: 0x06000D99 RID: 3481 RVA: 0x0003B9BC File Offset: 0x00039BBC
protected IDictionary<TKey, TItem> Dictionary
{
get
{
return this.dictionary;
}
}
// Token: 0x04000389 RID: 905
private Dictionary<TKey, TItem> dictionary;
// Token: 0x0400038A RID: 906
private IEqualityComparer<TKey> comparer;
// Token: 0x0400038B RID: 907
private int dictionaryCreationThreshold;
}
}
@@ -0,0 +1,324 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace System.Collections.ObjectModel
{
/// <summary>Provides the base class for a generic read-only collection. </summary>
/// <typeparam name="T">The type of elements in the collection.</typeparam>
// Token: 0x02000112 RID: 274
[ComVisible(false)]
[Serializable]
public class ReadOnlyCollection<T> : IEnumerable, ICollection, IList, ICollection<T>, IList<T>, IEnumerable<T>
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> class that is a read-only wrapper around the specified list.</summary>
/// <param name="list">The list to wrap.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="list" /> is null.</exception>
// Token: 0x06000D9A RID: 3482 RVA: 0x0003B9C4 File Offset: 0x00039BC4
public ReadOnlyCollection(IList<T> list)
{
if (list == null)
{
throw new ArgumentNullException("list");
}
this.list = list;
}
// Token: 0x06000D9B RID: 3483 RVA: 0x0003B9E4 File Offset: 0x00039BE4
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
// Token: 0x06000D9C RID: 3484 RVA: 0x0003B9EC File Offset: 0x00039BEC
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
// Token: 0x06000D9D RID: 3485 RVA: 0x0003B9F4 File Offset: 0x00039BF4
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
// Token: 0x06000D9E RID: 3486 RVA: 0x0003B9FC File Offset: 0x00039BFC
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
// Token: 0x06000D9F RID: 3487 RVA: 0x0003BA04 File Offset: 0x00039C04
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
// Token: 0x1700020B RID: 523
T IList<T>.this[int index]
{
get
{
return this[index];
}
set
{
throw new NotSupportedException();
}
}
// Token: 0x1700020C RID: 524
// (get) Token: 0x06000DA2 RID: 3490 RVA: 0x0003BA20 File Offset: 0x00039C20
bool ICollection<T>.IsReadOnly
{
get
{
return true;
}
}
/// <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 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: 0x06000DA3 RID: 3491 RVA: 0x0003BA24 File Offset: 0x00039C24
void ICollection.CopyTo(Array array, int index)
{
((ICollection)this.list).CopyTo(array, index);
}
/// <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: 0x06000DA4 RID: 3492 RVA: 0x0003BA38 File Offset: 0x00039C38
IEnumerator IEnumerable.GetEnumerator()
{
return this.list.GetEnumerator();
}
/// <summary>Adds an item to the <see cref="T:System.Collections.IList" />. This implementation always throws <see cref="T:System.NotSupportedException" />.</summary>
/// <returns>The position into which the new element was inserted.</returns>
/// <param name="value">The <see cref="T:System.Object" /> to add to the <see cref="T:System.Collections.IList" />.</param>
/// <exception cref="T:System.NotSupportedException">Always thrown.</exception>
// Token: 0x06000DA5 RID: 3493 RVA: 0x0003BA48 File Offset: 0x00039C48
int IList.Add(object value)
{
throw new NotSupportedException();
}
/// <summary>Removes all items from the <see cref="T:System.Collections.IList" />. This implementation always throws <see cref="T:System.NotSupportedException" />.</summary>
/// <exception cref="T:System.NotSupportedException">Always thrown.</exception>
// Token: 0x06000DA6 RID: 3494 RVA: 0x0003BA50 File Offset: 0x00039C50
void IList.Clear()
{
throw new NotSupportedException();
}
/// <summary>Determines whether the <see cref="T:System.Collections.IList" /> contains a specific value.</summary>
/// <returns>true if the <see cref="T:System.Object" /> is found in the <see cref="T:System.Collections.IList" />; otherwise, false.</returns>
/// <param name="value">The <see cref="T:System.Object" /> to locate in the <see cref="T:System.Collections.IList" />.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="value" /> is not of the type specified for the generic type parameter <paramref name="T" />.</exception>
// Token: 0x06000DA7 RID: 3495 RVA: 0x0003BA58 File Offset: 0x00039C58
bool IList.Contains(object value)
{
return Collection<T>.IsValidItem(value) && this.list.Contains((T)((object)value));
}
/// <summary>Determines the index of a specific item in the <see cref="T:System.Collections.IList" />.</summary>
/// <returns>The index of <paramref name="value" /> if found in the list; otherwise, -1.</returns>
/// <param name="value">The <see cref="T:System.Object" /> to locate in the <see cref="T:System.Collections.IList" />.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="value" /> is not of the type specified for the generic type parameter <paramref name="T" />.</exception>
// Token: 0x06000DA8 RID: 3496 RVA: 0x0003BA78 File Offset: 0x00039C78
int IList.IndexOf(object value)
{
if (Collection<T>.IsValidItem(value))
{
return this.list.IndexOf((T)((object)value));
}
return -1;
}
/// <summary>Inserts an item to the <see cref="T:System.Collections.IList" /> at the specified index. This implementation always throws <see cref="T:System.NotSupportedException" />.</summary>
/// <param name="index">The zero-based index at which <paramref name="value" /> should be inserted.</param>
/// <param name="value">The <see cref="T:System.Object" /> to insert into the <see cref="T:System.Collections.IList" />.</param>
/// <exception cref="T:System.NotSupportedException">Always thrown.</exception>
// Token: 0x06000DA9 RID: 3497 RVA: 0x0003BA98 File Offset: 0x00039C98
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
/// <summary>Removes the first occurrence of a specific object from the <see cref="T:System.Collections.IList" />. This implementation always throws <see cref="T:System.NotSupportedException" />.</summary>
/// <param name="value">The <see cref="T:System.Object" /> to remove from the <see cref="T:System.Collections.IList" />.</param>
/// <exception cref="T:System.NotSupportedException">Always thrown.</exception>
// Token: 0x06000DAA RID: 3498 RVA: 0x0003BAA0 File Offset: 0x00039CA0
void IList.Remove(object value)
{
throw new NotSupportedException();
}
/// <summary>Removes the <see cref="T:System.Collections.IList" /> item at the specified index. This implementation always throws <see cref="T:System.NotSupportedException" />.</summary>
/// <param name="index">The zero-based index of the item to remove.</param>
/// <exception cref="T:System.NotSupportedException">Always thrown.</exception>
// Token: 0x06000DAB RID: 3499 RVA: 0x0003BAA8 File Offset: 0x00039CA8
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
/// <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.ObjectModel.ReadOnlyCollection`1" />, this property always returns false.</returns>
// Token: 0x1700020D RID: 525
// (get) Token: 0x06000DAC RID: 3500 RVA: 0x0003BAB0 File Offset: 0x00039CB0
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.ObjectModel.ReadOnlyCollection`1" />, this property always returns the current instance.</returns>
// Token: 0x1700020E RID: 526
// (get) Token: 0x06000DAD RID: 3501 RVA: 0x0003BAB4 File Offset: 0x00039CB4
object ICollection.SyncRoot
{
get
{
return this;
}
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IList" /> has a fixed size.</summary>
/// <returns>true if the <see cref="T:System.Collections.IList" /> has a fixed size; otherwise, false. In the default implementation of <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />, this property always returns true.</returns>
// Token: 0x1700020F RID: 527
// (get) Token: 0x06000DAE RID: 3502 RVA: 0x0003BAB8 File Offset: 0x00039CB8
bool IList.IsFixedSize
{
get
{
return true;
}
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IList" /> is read-only.</summary>
/// <returns>true if the <see cref="T:System.Collections.IList" /> is read-only; otherwise, false. In the default implementation of <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />, this property always returns true.</returns>
// Token: 0x17000210 RID: 528
// (get) Token: 0x06000DAF RID: 3503 RVA: 0x0003BABC File Offset: 0x00039CBC
bool IList.IsReadOnly
{
get
{
return true;
}
}
/// <summary>Gets or sets the element at the specified index.</summary>
/// <returns>The element at the specified index.</returns>
/// <param name="index">The zero-based index of the element to get.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is not a valid index in the <see cref="T:System.Collections.IList" />. </exception>
/// <exception cref="T:System.NotSupportedException">Always thrown if the property is set.</exception>
// Token: 0x17000211 RID: 529
object IList.this[int index]
{
get
{
return this.list[index];
}
set
{
throw new NotSupportedException();
}
}
/// <summary>Determines whether an element is in the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />.</summary>
/// <returns>true if <paramref name="value" /> is found in the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />; otherwise, false.</returns>
/// <param name="value">The object to locate in the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />. The value can be null for reference types.</param>
// Token: 0x06000DB2 RID: 3506 RVA: 0x0003BADC File Offset: 0x00039CDC
public bool Contains(T value)
{
return this.list.Contains(value);
}
/// <summary>Copies the entire <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> to a compatible one-dimensional <see cref="T:System.Array" />, starting at the specified index of the target array.</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.ObjectModel.ReadOnlyCollection`1" />. 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 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.ObjectModel.ReadOnlyCollection`1" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
// Token: 0x06000DB3 RID: 3507 RVA: 0x0003BAEC File Offset: 0x00039CEC
public void CopyTo(T[] array, int index)
{
this.list.CopyTo(array, index);
}
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />.</summary>
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerator`1" /> for the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />.</returns>
// Token: 0x06000DB4 RID: 3508 RVA: 0x0003BAFC File Offset: 0x00039CFC
public IEnumerator<T> GetEnumerator()
{
return this.list.GetEnumerator();
}
/// <summary>Searches for the specified object and returns the zero-based index of the first occurrence within the entire <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />.</summary>
/// <returns>The zero-based index of the first occurrence of <paramref name="item" /> within the entire <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />, if found; otherwise, -1.</returns>
/// <param name="value">The object to locate in the <see cref="T:System.Collections.Generic.List`1" />. The value can be null for reference types.</param>
// Token: 0x06000DB5 RID: 3509 RVA: 0x0003BB0C File Offset: 0x00039D0C
public int IndexOf(T value)
{
return this.list.IndexOf(value);
}
/// <summary>Gets the number of elements contained in the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> instance.</summary>
/// <returns>The number of elements contained in the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> instance.</returns>
// Token: 0x17000212 RID: 530
// (get) Token: 0x06000DB6 RID: 3510 RVA: 0x0003BB1C File Offset: 0x00039D1C
public int Count
{
get
{
return this.list.Count;
}
}
/// <summary>Returns the <see cref="T:System.Collections.Generic.IList`1" /> that the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> wraps.</summary>
/// <returns>The <see cref="T:System.Collections.Generic.IList`1" /> that the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> wraps.</returns>
// Token: 0x17000213 RID: 531
// (get) Token: 0x06000DB7 RID: 3511 RVA: 0x0003BB2C File Offset: 0x00039D2C
protected IList<T> Items
{
get
{
return this.list;
}
}
/// <summary>Gets the element at the specified index.</summary>
/// <returns>The element at the specified index.</returns>
/// <param name="index">The zero-based index of the element to get.</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.ObjectModel.ReadOnlyCollection`1.Count" />. </exception>
// Token: 0x17000214 RID: 532
public T this[int index]
{
get
{
return this.list[index];
}
}
// Token: 0x0400038C RID: 908
private IList<T> list;
}
}