C#List源码
2023-07-28 本文已影响0人
好怕怕
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Runtime.Versioning;
using System.Threading;
namespace System.Collections.Generic
{
/// <summary>Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.</summary>
/// <typeparam name="T">The type of elements in the list.</typeparam>
// Token: 0x020004DA RID: 1242
[DebuggerTypeProxy(typeof(Mscorlib_CollectionDebugView<>))]
[DebuggerDisplay("Count = {Count}")]
[__DynamicallyInvokable]
[Serializable]
public class List<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.List`1" /> class that is empty and has the default initial capacity.</summary>
// Token: 0x06003B0C RID: 15116 RVA: 0x000E139D File Offset: 0x000DF59D
[__DynamicallyInvokable]
public List()
{
this._items = List<T>._emptyArray;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.List`1" /> class that is empty and has the specified initial capacity.</summary>
/// <param name="capacity">The number of elements that the new list can initially store.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than 0.</exception>
// Token: 0x06003B0D RID: 15117 RVA: 0x000E13B0 File Offset: 0x000DF5B0
[__DynamicallyInvokable]
public List(int capacity)
{
if (capacity < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.capacity, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (capacity == 0)
{
this._items = List<T>._emptyArray;
return;
}
this._items = new T[capacity];
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.List`1" /> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.</summary>
/// <param name="collection">The collection whose elements are copied to the new list.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="collection" /> is <see langword="null" />.</exception>
// Token: 0x06003B0E RID: 15118 RVA: 0x000E13E0 File Offset: 0x000DF5E0
[__DynamicallyInvokable]
public List(IEnumerable<T> collection)
{
if (collection == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection);
}
ICollection<T> collection2 = collection as ICollection<T>;
if (collection2 == null)
{
this._size = 0;
this._items = List<T>._emptyArray;
foreach (T item in collection)
{
this.Add(item);
}
return;
}
int count = collection2.Count;
if (count == 0)
{
this._items = List<T>._emptyArray;
return;
}
this._items = new T[count];
collection2.CopyTo(this._items, 0);
this._size = count;
}
/// <summary>Gets or sets the total number of elements the internal data structure can hold without resizing.</summary>
/// <returns>The number of elements that the <see cref="T:System.Collections.Generic.List`1" /> can contain before resizing is required.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <see cref="P:System.Collections.Generic.List`1.Capacity" /> is set to a value that is less than <see cref="P:System.Collections.Generic.List`1.Count" />.</exception>
/// <exception cref="T:System.OutOfMemoryException">There is not enough memory available on the system.</exception>
// Token: 0x170008F4 RID: 2292
// (get) Token: 0x06003B0F RID: 15119 RVA: 0x000E1488 File Offset: 0x000DF688
// (set) Token: 0x06003B10 RID: 15120 RVA: 0x000E1494 File Offset: 0x000DF694
[__DynamicallyInvokable]
public int Capacity
{
[__DynamicallyInvokable]
get
{
return this._items.Length;
}
[__DynamicallyInvokable]
set
{
if (value < this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.value, ExceptionResource.ArgumentOutOfRange_SmallCapacity);
}
if (value != this._items.Length)
{
if (value > 0)
{
T[] array = new T[value];
if (this._size > 0)
{
Array.Copy(this._items, 0, array, 0, this._size);
}
this._items = array;
return;
}
this._items = List<T>._emptyArray;
}
}
}
/// <summary>Gets the number of elements contained in the <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <returns>The number of elements contained in the <see cref="T:System.Collections.Generic.List`1" />.</returns>
// Token: 0x170008F5 RID: 2293
// (get) Token: 0x06003B11 RID: 15121 RVA: 0x000E14F9 File Offset: 0x000DF6F9
[__DynamicallyInvokable]
public int Count
{
[__DynamicallyInvokable]
get
{
return this._size;
}
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IList" /> has a fixed size.</summary>
/// <returns>
/// <see langword="true" /> if the <see cref="T:System.Collections.IList" /> has a fixed size; otherwise, <see langword="false" />. In the default implementation of <see cref="T:System.Collections.Generic.List`1" />, this property always returns <see langword="false" />.</returns>
// Token: 0x170008F6 RID: 2294
// (get) Token: 0x06003B12 RID: 15122 RVA: 0x000E1501 File Offset: 0x000DF701
[__DynamicallyInvokable]
bool IList.IsFixedSize
{
[__DynamicallyInvokable]
get
{
return false;
}
}
// Token: 0x170008F7 RID: 2295
// (get) Token: 0x06003B13 RID: 15123 RVA: 0x000E1504 File Offset: 0x000DF704
[__DynamicallyInvokable]
bool ICollection<!0>.IsReadOnly
{
[__DynamicallyInvokable]
get
{
return false;
}
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IList" /> is read-only.</summary>
/// <returns>
/// <see langword="true" /> if the <see cref="T:System.Collections.IList" /> is read-only; otherwise, <see langword="false" />. In the default implementation of <see cref="T:System.Collections.Generic.List`1" />, this property always returns <see langword="false" />.</returns>
// Token: 0x170008F8 RID: 2296
// (get) Token: 0x06003B14 RID: 15124 RVA: 0x000E1507 File Offset: 0x000DF707
[__DynamicallyInvokable]
bool IList.IsReadOnly
{
[__DynamicallyInvokable]
get
{
return false;
}
}
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
/// <returns>
/// <see langword="true" /> if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, <see langword="false" />. In the default implementation of <see cref="T:System.Collections.Generic.List`1" />, this property always returns <see langword="false" />.</returns>
// Token: 0x170008F9 RID: 2297
// (get) Token: 0x06003B15 RID: 15125 RVA: 0x000E150A File Offset: 0x000DF70A
[__DynamicallyInvokable]
bool ICollection.IsSynchronized
{
[__DynamicallyInvokable]
get
{
return false;
}
}
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. In the default implementation of <see cref="T:System.Collections.Generic.List`1" />, this property always returns the current instance.</returns>
// Token: 0x170008FA RID: 2298
// (get) Token: 0x06003B16 RID: 15126 RVA: 0x000E150D File Offset: 0x000DF70D
[__DynamicallyInvokable]
object ICollection.SyncRoot
{
[__DynamicallyInvokable]
get
{
if (this._syncRoot == null)
{
Interlocked.CompareExchange<object>(ref this._syncRoot, new object(), null);
}
return this._syncRoot;
}
}
/// <summary>Gets or sets the element at the specified index.</summary>
/// <param name="index">The zero-based index of the element to get or set.</param>
/// <returns>The element at the specified index.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.
/// -or-
/// <paramref name="index" /> is equal to or greater than <see cref="P:System.Collections.Generic.List`1.Count" />.</exception>
// Token: 0x170008FB RID: 2299
[__DynamicallyInvokable]
public T this[int index]
{
[__DynamicallyInvokable]
get
{
if (index >= this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException();
}
return this._items[index];
}
[__DynamicallyInvokable]
set
{
if (index >= this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException();
}
this._items[index] = value;
this._version++;
}
}
// Token: 0x06003B19 RID: 15129 RVA: 0x000E1578 File Offset: 0x000DF778
private static bool IsCompatibleObject(object value)
{
return value is T || (value == null && default(T) == null);
}
/// <summary>Gets or sets the element at the specified index.</summary>
/// <param name="index">The zero-based index of the element to get or set.</param>
/// <returns>The element at the specified index.</returns>
/// <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="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
// Token: 0x170008FC RID: 2300
[__DynamicallyInvokable]
object IList.this[int index]
{
[__DynamicallyInvokable]
get
{
return this[index];
}
[__DynamicallyInvokable]
set
{
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<T>(value, ExceptionArgument.value);
try
{
this[index] = (T)((object)value);
}
catch (InvalidCastException)
{
ThrowHelper.ThrowWrongValueTypeArgumentException(value, typeof(T));
}
}
}
/// <summary>Adds an object to the end of the <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="item">The object to be added to the end of the <see cref="T:System.Collections.Generic.List`1" />. The value can be <see langword="null" /> for reference types.</param>
// Token: 0x06003B1C RID: 15132 RVA: 0x000E15FC File Offset: 0x000DF7FC
[__DynamicallyInvokable]
public void Add(T item)
{
if (this._size == this._items.Length)
{
this.EnsureCapacity(this._size + 1);
}
T[] items = this._items;
int size = this._size;
this._size = size + 1;
items[size] = item;
this._version++;
}
/// <summary>Adds an item to the <see cref="T:System.Collections.IList" />.</summary>
/// <param name="item">The <see cref="T:System.Object" /> to add to the <see cref="T:System.Collections.IList" />.</param>
/// <returns>The position into which the new element was inserted.</returns>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="item" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
// Token: 0x06003B1D RID: 15133 RVA: 0x000E1654 File Offset: 0x000DF854
[__DynamicallyInvokable]
int IList.Add(object item)
{
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<T>(item, ExceptionArgument.item);
try
{
this.Add((T)((object)item));
}
catch (InvalidCastException)
{
ThrowHelper.ThrowWrongValueTypeArgumentException(item, typeof(T));
}
return this.Count - 1;
}
/// <summary>Adds the elements of the specified collection to the end of the <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="collection">The collection whose elements should be added to the end of the <see cref="T:System.Collections.Generic.List`1" />. The collection itself cannot be <see langword="null" />, but it can contain elements that are <see langword="null" />, if type <paramref name="T" /> is a reference type.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="collection" /> is <see langword="null" />.</exception>
// Token: 0x06003B1E RID: 15134 RVA: 0x000E16A4 File Offset: 0x000DF8A4
[__DynamicallyInvokable]
public void AddRange(IEnumerable<T> collection)
{
this.InsertRange(this._size, collection);
}
/// <summary>Returns a read-only <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> wrapper for the current collection.</summary>
/// <returns>An object that acts as a read-only wrapper around the current <see cref="T:System.Collections.Generic.List`1" />.</returns>
// Token: 0x06003B1F RID: 15135 RVA: 0x000E16B3 File Offset: 0x000DF8B3
[__DynamicallyInvokable]
public ReadOnlyCollection<T> AsReadOnly()
{
return new ReadOnlyCollection<T>(this);
}
/// <summary>Searches a range of elements in the sorted <see cref="T:System.Collections.Generic.List`1" /> for an element using the specified comparer and returns the zero-based index of the element.</summary>
/// <param name="index">The zero-based starting index of the range to search.</param>
/// <param name="count">The length of the range to search.</param>
/// <param name="item">The object to locate. The value can be <see langword="null" /> for reference types.</param>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing elements, or <see langword="null" /> to use the default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default" />.</param>
/// <returns>The zero-based index of <paramref name="item" /> in the sorted <see cref="T:System.Collections.Generic.List`1" />, if <paramref name="item" /> is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than <paramref name="item" /> or, if there is no larger element, the bitwise complement of <see cref="P:System.Collections.Generic.List`1.Count" />.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.
/// -or-
/// <paramref name="count" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in the <see cref="T:System.Collections.Generic.List`1" />.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="comparer" /> is <see langword="null" />, and the default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default" /> cannot find an implementation of the <see cref="T:System.IComparable`1" /> generic interface or the <see cref="T:System.IComparable" /> interface for type <paramref name="T" />.</exception>
// Token: 0x06003B20 RID: 15136 RVA: 0x000E16BB File Offset: 0x000DF8BB
[__DynamicallyInvokable]
public int BinarySearch(int index, int count, T item, IComparer<T> comparer)
{
if (index < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (this._size - index < count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
return Array.BinarySearch<T>(this._items, index, count, item, comparer);
}
/// <summary>Searches the entire sorted <see cref="T:System.Collections.Generic.List`1" /> for an element using the default comparer and returns the zero-based index of the element.</summary>
/// <param name="item">The object to locate. The value can be <see langword="null" /> for reference types.</param>
/// <returns>The zero-based index of <paramref name="item" /> in the sorted <see cref="T:System.Collections.Generic.List`1" />, if <paramref name="item" /> is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than <paramref name="item" /> or, if there is no larger element, the bitwise complement of <see cref="P:System.Collections.Generic.List`1.Count" />.</returns>
/// <exception cref="T:System.InvalidOperationException">The default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default" /> cannot find an implementation of the <see cref="T:System.IComparable`1" /> generic interface or the <see cref="T:System.IComparable" /> interface for type <paramref name="T" />.</exception>
// Token: 0x06003B21 RID: 15137 RVA: 0x000E16F7 File Offset: 0x000DF8F7
[__DynamicallyInvokable]
public int BinarySearch(T item)
{
return this.BinarySearch(0, this.Count, item, null);
}
/// <summary>Searches the entire sorted <see cref="T:System.Collections.Generic.List`1" /> for an element using the specified comparer and returns the zero-based index of the element.</summary>
/// <param name="item">The object to locate. The value can be <see langword="null" /> for reference types.</param>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing elements.
/// -or-
/// <see langword="null" /> to use the default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default" />.</param>
/// <returns>The zero-based index of <paramref name="item" /> in the sorted <see cref="T:System.Collections.Generic.List`1" />, if <paramref name="item" /> is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than <paramref name="item" /> or, if there is no larger element, the bitwise complement of <see cref="P:System.Collections.Generic.List`1.Count" />.</returns>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="comparer" /> is <see langword="null" />, and the default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default" /> cannot find an implementation of the <see cref="T:System.IComparable`1" /> generic interface or the <see cref="T:System.IComparable" /> interface for type <paramref name="T" />.</exception>
// Token: 0x06003B22 RID: 15138 RVA: 0x000E1708 File Offset: 0x000DF908
[__DynamicallyInvokable]
public int BinarySearch(T item, IComparer<T> comparer)
{
return this.BinarySearch(0, this.Count, item, comparer);
}
/// <summary>Removes all elements from the <see cref="T:System.Collections.Generic.List`1" />.</summary>
// Token: 0x06003B23 RID: 15139 RVA: 0x000E1719 File Offset: 0x000DF919
[__DynamicallyInvokable]
public void Clear()
{
if (this._size > 0)
{
Array.Clear(this._items, 0, this._size);
this._size = 0;
}
this._version++;
}
/// <summary>Determines whether an element is in the <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.List`1" />. The value can be <see langword="null" /> for reference types.</param>
/// <returns>
/// <see langword="true" /> if <paramref name="item" /> is found in the <see cref="T:System.Collections.Generic.List`1" />; otherwise, <see langword="false" />.</returns>
// Token: 0x06003B24 RID: 15140 RVA: 0x000E174C File Offset: 0x000DF94C
[__DynamicallyInvokable]
public bool Contains(T item)
{
if (item == null)
{
for (int i = 0; i < this._size; i++)
{
if (this._items[i] == null)
{
return true;
}
}
return false;
}
EqualityComparer<T> @default = EqualityComparer<T>.Default;
for (int j = 0; j < this._size; j++)
{
if (@default.Equals(this._items[j], item))
{
return true;
}
}
return false;
}
/// <summary>Determines whether the <see cref="T:System.Collections.IList" /> contains a specific value.</summary>
/// <param name="item">The <see cref="T:System.Object" /> to locate in the <see cref="T:System.Collections.IList" />.</param>
/// <returns>
/// <see langword="true" /> if <paramref name="item" /> is found in the <see cref="T:System.Collections.IList" />; otherwise, <see langword="false" />.</returns>
// Token: 0x06003B25 RID: 15141 RVA: 0x000E17B8 File Offset: 0x000DF9B8
[__DynamicallyInvokable]
bool IList.Contains(object item)
{
return List<T>.IsCompatibleObject(item) && this.Contains((T)((object)item));
}
/// <summary>Converts the elements in the current <see cref="T:System.Collections.Generic.List`1" /> to another type, and returns a list containing the converted elements.</summary>
/// <param name="converter">A <see cref="T:System.Converter`2" /> delegate that converts each element from one type to another type.</param>
/// <typeparam name="TOutput">The type of the elements of the target array.</typeparam>
/// <returns>A <see cref="T:System.Collections.Generic.List`1" /> of the target type containing the converted elements from the current <see cref="T:System.Collections.Generic.List`1" />.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="converter" /> is <see langword="null" />.</exception>
// Token: 0x06003B26 RID: 15142 RVA: 0x000E17D0 File Offset: 0x000DF9D0
public List<TOutput> ConvertAll<TOutput>(Converter<T, TOutput> converter)
{
if (converter == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.converter);
}
List<TOutput> list = new List<TOutput>(this._size);
for (int i = 0; i < this._size; i++)
{
list._items[i] = converter(this._items[i]);
}
list._size = this._size;
return list;
}
/// <summary>Copies the entire <see cref="T:System.Collections.Generic.List`1" /> to a compatible one-dimensional array, starting at the beginning 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.Generic.List`1" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.List`1" /> is greater than the number of elements that the destination <paramref name="array" /> can contain.</exception>
// Token: 0x06003B27 RID: 15143 RVA: 0x000E182F File Offset: 0x000DFA2F
[__DynamicallyInvokable]
public void CopyTo(T[] array)
{
this.CopyTo(array, 0);
}
/// <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 <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="arrayIndex" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.
/// -or-
/// <paramref name="array" /> does not have zero-based indexing.
/// -or-
/// The number of elements in the source <see cref="T:System.Collections.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: 0x06003B28 RID: 15144 RVA: 0x000E183C File Offset: 0x000DFA3C
[__DynamicallyInvokable]
void ICollection.CopyTo(Array array, int arrayIndex)
{
if (array != null && array.Rank != 1)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
}
try
{
Array.Copy(this._items, 0, array, arrayIndex, this._size);
}
catch (ArrayTypeMismatchException)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArrayType);
}
}
/// <summary>Copies a range of elements from the <see cref="T:System.Collections.Generic.List`1" /> to a compatible one-dimensional array, starting at the specified index of the target array.</summary>
/// <param name="index">The zero-based index in the source <see cref="T:System.Collections.Generic.List`1" /> at which copying begins.</param>
/// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.List`1" />. 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>
/// <param name="count">The number of elements to copy.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.
/// -or-
/// <paramref name="arrayIndex" /> is less than 0.
/// -or-
/// <paramref name="count" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="index" /> is equal to or greater than the <see cref="P:System.Collections.Generic.List`1.Count" /> of the source <see cref="T:System.Collections.Generic.List`1" />.
/// -or-
/// The number of elements from <paramref name="index" /> to the end of the source <see cref="T:System.Collections.Generic.List`1" /> is greater than the available space from <paramref name="arrayIndex" /> to the end of the destination <paramref name="array" />.</exception>
// Token: 0x06003B29 RID: 15145 RVA: 0x000E188C File Offset: 0x000DFA8C
[__DynamicallyInvokable]
public void CopyTo(int index, T[] array, int arrayIndex, int count)
{
if (this._size - index < count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
Array.Copy(this._items, index, array, arrayIndex, count);
}
/// <summary>Copies the entire <see cref="T:System.Collections.Generic.List`1" /> to a compatible one-dimensional 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.Generic.List`1" />. 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 <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="arrayIndex" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.List`1" /> is greater than the available space from <paramref name="arrayIndex" /> to the end of the destination <paramref name="array" />.</exception>
// Token: 0x06003B2A RID: 15146 RVA: 0x000E18B1 File Offset: 0x000DFAB1
[__DynamicallyInvokable]
public void CopyTo(T[] array, int arrayIndex)
{
Array.Copy(this._items, 0, array, arrayIndex, this._size);
}
// Token: 0x06003B2B RID: 15147 RVA: 0x000E18C8 File Offset: 0x000DFAC8
private void EnsureCapacity(int min)
{
if (this._items.Length < min)
{
int num = (this._items.Length == 0) ? 4 : (this._items.Length * 2);
if (num > 2146435071)
{
num = 2146435071;
}
if (num < min)
{
num = min;
}
this.Capacity = num;
}
}
/// <summary>Determines whether the <see cref="T:System.Collections.Generic.List`1" /> contains elements that match the conditions defined by the specified predicate.</summary>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions of the elements to search for.</param>
/// <returns>
/// <see langword="true" /> if the <see cref="T:System.Collections.Generic.List`1" /> contains one or more elements that match the conditions defined by the specified predicate; otherwise, <see langword="false" />.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
// Token: 0x06003B2C RID: 15148 RVA: 0x000E1912 File Offset: 0x000DFB12
[__DynamicallyInvokable]
public bool Exists(Predicate<T> match)
{
return this.FindIndex(match) != -1;
}
/// <summary>Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions of the element to search for.</param>
/// <returns>The first element that matches the conditions defined by the specified predicate, if found; otherwise, the default value for type <paramref name="T" />.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
// Token: 0x06003B2D RID: 15149 RVA: 0x000E1924 File Offset: 0x000DFB24
[__DynamicallyInvokable]
public T Find(Predicate<T> match)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
for (int i = 0; i < this._size; i++)
{
if (match(this._items[i]))
{
return this._items[i];
}
}
return default(T);
}
/// <summary>Retrieves all the elements that match the conditions defined by the specified predicate.</summary>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions of the elements to search for.</param>
/// <returns>A <see cref="T:System.Collections.Generic.List`1" /> containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty <see cref="T:System.Collections.Generic.List`1" />.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
// Token: 0x06003B2E RID: 15150 RVA: 0x000E1978 File Offset: 0x000DFB78
[__DynamicallyInvokable]
public List<T> FindAll(Predicate<T> match)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
List<T> list = new List<T>();
for (int i = 0; i < this._size; i++)
{
if (match(this._items[i]))
{
list.Add(this._items[i]);
}
}
return list;
}
/// <summary>Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions of the element to search for.</param>
/// <returns>The zero-based index of the first occurrence of an element that matches the conditions defined by <paramref name="match" />, if found; otherwise, -1.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
// Token: 0x06003B2F RID: 15151 RVA: 0x000E19CC File Offset: 0x000DFBCC
[__DynamicallyInvokable]
public int FindIndex(Predicate<T> match)
{
return this.FindIndex(0, this._size, match);
}
/// <summary>Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that extends from the specified index to the last element.</summary>
/// <param name="startIndex">The zero-based starting index of the search.</param>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions of the element to search for.</param>
/// <returns>The zero-based index of the first occurrence of an element that matches the conditions defined by <paramref name="match" />, if found; otherwise, -1.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="startIndex" /> is outside the range of valid indexes for the <see cref="T:System.Collections.Generic.List`1" />.</exception>
// Token: 0x06003B30 RID: 15152 RVA: 0x000E19DC File Offset: 0x000DFBDC
[__DynamicallyInvokable]
public int FindIndex(int startIndex, Predicate<T> match)
{
return this.FindIndex(startIndex, this._size - startIndex, match);
}
/// <summary>Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that starts at the specified index and contains the specified number of elements.</summary>
/// <param name="startIndex">The zero-based starting index of the search.</param>
/// <param name="count">The number of elements in the section to search.</param>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions of the element to search for.</param>
/// <returns>The zero-based index of the first occurrence of an element that matches the conditions defined by <paramref name="match" />, if found; otherwise, -1.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="startIndex" /> is outside the range of valid indexes for the <see cref="T:System.Collections.Generic.List`1" />.
/// -or-
/// <paramref name="count" /> is less than 0.
/// -or-
/// <paramref name="startIndex" /> and <paramref name="count" /> do not specify a valid section in the <see cref="T:System.Collections.Generic.List`1" />.</exception>
// Token: 0x06003B31 RID: 15153 RVA: 0x000E19F0 File Offset: 0x000DFBF0
[__DynamicallyInvokable]
public int FindIndex(int startIndex, int count, Predicate<T> match)
{
if (startIndex > this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
}
if (count < 0 || startIndex > this._size - count)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count);
}
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
int num = startIndex + count;
for (int i = startIndex; i < num; i++)
{
if (match(this._items[i]))
{
return i;
}
}
return -1;
}
/// <summary>Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions of the element to search for.</param>
/// <returns>The last element that matches the conditions defined by the specified predicate, if found; otherwise, the default value for type <paramref name="T" />.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
// Token: 0x06003B32 RID: 15154 RVA: 0x000E1A58 File Offset: 0x000DFC58
[__DynamicallyInvokable]
public T FindLast(Predicate<T> match)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
for (int i = this._size - 1; i >= 0; i--)
{
if (match(this._items[i]))
{
return this._items[i];
}
}
return default(T);
}
/// <summary>Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions of the element to search for.</param>
/// <returns>The zero-based index of the last occurrence of an element that matches the conditions defined by <paramref name="match" />, if found; otherwise, -1.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
// Token: 0x06003B33 RID: 15155 RVA: 0x000E1AAB File Offset: 0x000DFCAB
[__DynamicallyInvokable]
public int FindLastIndex(Predicate<T> match)
{
return this.FindLastIndex(this._size - 1, this._size, match);
}
/// <summary>Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that extends from the first element to the specified index.</summary>
/// <param name="startIndex">The zero-based starting index of the backward search.</param>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions of the element to search for.</param>
/// <returns>The zero-based index of the last occurrence of an element that matches the conditions defined by <paramref name="match" />, if found; otherwise, -1.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="startIndex" /> is outside the range of valid indexes for the <see cref="T:System.Collections.Generic.List`1" />.</exception>
// Token: 0x06003B34 RID: 15156 RVA: 0x000E1AC2 File Offset: 0x000DFCC2
[__DynamicallyInvokable]
public int FindLastIndex(int startIndex, Predicate<T> match)
{
return this.FindLastIndex(startIndex, startIndex + 1, match);
}
/// <summary>Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that contains the specified number of elements and ends at the specified index.</summary>
/// <param name="startIndex">The zero-based starting index of the backward search.</param>
/// <param name="count">The number of elements in the section to search.</param>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions of the element to search for.</param>
/// <returns>The zero-based index of the last occurrence of an element that matches the conditions defined by <paramref name="match" />, if found; otherwise, -1.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="startIndex" /> is outside the range of valid indexes for the <see cref="T:System.Collections.Generic.List`1" />.
/// -or-
/// <paramref name="count" /> is less than 0.
/// -or-
/// <paramref name="startIndex" /> and <paramref name="count" /> do not specify a valid section in the <see cref="T:System.Collections.Generic.List`1" />.</exception>
// Token: 0x06003B35 RID: 15157 RVA: 0x000E1AD0 File Offset: 0x000DFCD0
[__DynamicallyInvokable]
public int FindLastIndex(int startIndex, int count, Predicate<T> match)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
if (this._size == 0)
{
if (startIndex != -1)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
}
}
else if (startIndex >= this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
}
if (count < 0 || startIndex - count + 1 < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count);
}
int num = startIndex - count;
for (int i = startIndex; i > num; i--)
{
if (match(this._items[i]))
{
return i;
}
}
return -1;
}
/// <summary>Performs the specified action on each element of the <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="action">The <see cref="T:System.Action`1" /> delegate to perform on each element of the <see cref="T:System.Collections.Generic.List`1" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="action" /> is <see langword="null" />.</exception>
/// <exception cref="T:System.InvalidOperationException">An element in the collection has been modified.</exception>
// Token: 0x06003B36 RID: 15158 RVA: 0x000E1B4C File Offset: 0x000DFD4C
[__DynamicallyInvokable]
public void ForEach(Action<T> action)
{
if (action == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
int version = this._version;
int num = 0;
while (num < this._size && (version == this._version || !BinaryCompatibility.TargetsAtLeast_Desktop_V4_5))
{
action(this._items[num]);
num++;
}
if (version != this._version && BinaryCompatibility.TargetsAtLeast_Desktop_V4_5)
{
ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumFailedVersion);
}
}
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <returns>A <see cref="T:System.Collections.Generic.List`1.Enumerator" /> for the <see cref="T:System.Collections.Generic.List`1" />.</returns>
// Token: 0x06003B37 RID: 15159 RVA: 0x000E1BB3 File Offset: 0x000DFDB3
[__DynamicallyInvokable]
public List<T>.Enumerator GetEnumerator()
{
return new List<T>.Enumerator(this);
}
// Token: 0x06003B38 RID: 15160 RVA: 0x000E1BBB File Offset: 0x000DFDBB
[__DynamicallyInvokable]
IEnumerator<T> IEnumerable<!0>.GetEnumerator()
{
return new List<T>.Enumerator(this);
}
/// <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: 0x06003B39 RID: 15161 RVA: 0x000E1BC8 File Offset: 0x000DFDC8
[__DynamicallyInvokable]
IEnumerator IEnumerable.GetEnumerator()
{
return new List<T>.Enumerator(this);
}
/// <summary>Creates a shallow copy of a range of elements in the source <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="index">The zero-based <see cref="T:System.Collections.Generic.List`1" /> index at which the range starts.</param>
/// <param name="count">The number of elements in the range.</param>
/// <returns>A shallow copy of a range of elements in the source <see cref="T:System.Collections.Generic.List`1" />.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.
/// -or-
/// <paramref name="count" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="index" /> and <paramref name="count" /> do not denote a valid range of elements in the <see cref="T:System.Collections.Generic.List`1" />.</exception>
// Token: 0x06003B3A RID: 15162 RVA: 0x000E1BD8 File Offset: 0x000DFDD8
[__DynamicallyInvokable]
public List<T> GetRange(int index, int count)
{
if (index < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (this._size - index < count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
List<T> list = new List<T>(count);
Array.Copy(this._items, index, list._items, 0, count);
list._size = count;
return list;
}
/// <summary>Searches for the specified object and returns the zero-based index of the first occurrence within the entire <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.List`1" />. The value can be <see langword="null" /> for reference types.</param>
/// <returns>The zero-based index of the first occurrence of <paramref name="item" /> within the entire <see cref="T:System.Collections.Generic.List`1" />, if found; otherwise, -1.</returns>
// Token: 0x06003B3B RID: 15163 RVA: 0x000E1C32 File Offset: 0x000DFE32
[__DynamicallyInvokable]
public int IndexOf(T item)
{
return Array.IndexOf<T>(this._items, item, 0, this._size);
}
/// <summary>Determines the index of a specific item in the <see cref="T:System.Collections.IList" />.</summary>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.IList" />.</param>
/// <returns>The index of <paramref name="item" /> if found in the list; otherwise, -1.</returns>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="item" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
// Token: 0x06003B3C RID: 15164 RVA: 0x000E1C47 File Offset: 0x000DFE47
[__DynamicallyInvokable]
int IList.IndexOf(object item)
{
if (List<T>.IsCompatibleObject(item))
{
return this.IndexOf((T)((object)item));
}
return -1;
}
/// <summary>Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that extends from the specified index to the last element.</summary>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.List`1" />. The value can be <see langword="null" /> for reference types.</param>
/// <param name="index">The zero-based starting index of the search. 0 (zero) is valid in an empty list.</param>
/// <returns>The zero-based index of the first occurrence of <paramref name="item" /> within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that extends from <paramref name="index" /> to the last element, if found; otherwise, -1.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is outside the range of valid indexes for the <see cref="T:System.Collections.Generic.List`1" />.</exception>
// Token: 0x06003B3D RID: 15165 RVA: 0x000E1C5F File Offset: 0x000DFE5F
[__DynamicallyInvokable]
public int IndexOf(T item, int index)
{
if (index > this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_Index);
}
return Array.IndexOf<T>(this._items, item, index, this._size - index);
}
/// <summary>Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that starts at the specified index and contains the specified number of elements.</summary>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.List`1" />. The value can be <see langword="null" /> for reference types.</param>
/// <param name="index">The zero-based starting index of the search. 0 (zero) is valid in an empty list.</param>
/// <param name="count">The number of elements in the section to search.</param>
/// <returns>The zero-based index of the first occurrence of <paramref name="item" /> within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that starts at <paramref name="index" /> and contains <paramref name="count" /> number of elements, if found; otherwise, -1.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is outside the range of valid indexes for the <see cref="T:System.Collections.Generic.List`1" />.
/// -or-
/// <paramref name="count" /> is less than 0.
/// -or-
/// <paramref name="index" /> and <paramref name="count" /> do not specify a valid section in the <see cref="T:System.Collections.Generic.List`1" />.</exception>
// Token: 0x06003B3E RID: 15166 RVA: 0x000E1C88 File Offset: 0x000DFE88
[__DynamicallyInvokable]
public int IndexOf(T item, int index, int count)
{
if (index > this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_Index);
}
if (count < 0 || index > this._size - count)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count);
}
return Array.IndexOf<T>(this._items, item, index, count);
}
/// <summary>Inserts an element into the <see cref="T:System.Collections.Generic.List`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 <see langword="null" /> for reference types.</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.Generic.List`1.Count" />.</exception>
// Token: 0x06003B3F RID: 15167 RVA: 0x000E1CC4 File Offset: 0x000DFEC4
[__DynamicallyInvokable]
public void Insert(int index, T item)
{
if (index > this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_ListInsert);
}
if (this._size == this._items.Length)
{
this.EnsureCapacity(this._size + 1);
}
if (index < this._size)
{
Array.Copy(this._items, index, this._items, index + 1, this._size - index);
}
this._items[index] = item;
this._size++;
this._version++;
}
/// <summary>Inserts an item to the <see cref="T:System.Collections.IList" /> 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 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="item" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
// Token: 0x06003B40 RID: 15168 RVA: 0x000E1D50 File Offset: 0x000DFF50
[__DynamicallyInvokable]
void IList.Insert(int index, object item)
{
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<T>(item, ExceptionArgument.item);
try
{
this.Insert(index, (T)((object)item));
}
catch (InvalidCastException)
{
ThrowHelper.ThrowWrongValueTypeArgumentException(item, typeof(T));
}
}
/// <summary>Inserts the elements of a collection into the <see cref="T:System.Collections.Generic.List`1" /> at the specified index.</summary>
/// <param name="index">The zero-based index at which the new elements should be inserted.</param>
/// <param name="collection">The collection whose elements should be inserted into the <see cref="T:System.Collections.Generic.List`1" />. The collection itself cannot be <see langword="null" />, but it can contain elements that are <see langword="null" />, if type <paramref name="T" /> is a reference type.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="collection" /> is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.
/// -or-
/// <paramref name="index" /> is greater than <see cref="P:System.Collections.Generic.List`1.Count" />.</exception>
// Token: 0x06003B41 RID: 15169 RVA: 0x000E1D98 File Offset: 0x000DFF98
[__DynamicallyInvokable]
public void InsertRange(int index, IEnumerable<T> collection)
{
if (collection == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection);
}
if (index > this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_Index);
}
ICollection<T> collection2 = collection as ICollection<T>;
if (collection2 != null)
{
int count = collection2.Count;
if (count > 0)
{
this.EnsureCapacity(this._size + count);
if (index < this._size)
{
Array.Copy(this._items, index, this._items, index + count, this._size - index);
}
if (this == collection2)
{
Array.Copy(this._items, 0, this._items, index, index);
Array.Copy(this._items, index + count, this._items, index * 2, this._size - index);
}
else
{
T[] array = new T[count];
collection2.CopyTo(array, 0);
array.CopyTo(this._items, index);
}
this._size += count;
}
}
else
{
foreach (T item in collection)
{
this.Insert(index++, item);
}
}
this._version++;
}
/// <summary>Searches for the specified object and returns the zero-based index of the last occurrence within the entire <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.List`1" />. The value can be <see langword="null" /> for reference types.</param>
/// <returns>The zero-based index of the last occurrence of <paramref name="item" /> within the entire the <see cref="T:System.Collections.Generic.List`1" />, if found; otherwise, -1.</returns>
// Token: 0x06003B42 RID: 15170 RVA: 0x000E1EC4 File Offset: 0x000E00C4
[__DynamicallyInvokable]
public int LastIndexOf(T item)
{
if (this._size == 0)
{
return -1;
}
return this.LastIndexOf(item, this._size - 1, this._size);
}
/// <summary>Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that extends from the first element to the specified index.</summary>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.List`1" />. The value can be <see langword="null" /> for reference types.</param>
/// <param name="index">The zero-based starting index of the backward search.</param>
/// <returns>The zero-based index of the last occurrence of <paramref name="item" /> within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that extends from the first element to <paramref name="index" />, if found; otherwise, -1.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is outside the range of valid indexes for the <see cref="T:System.Collections.Generic.List`1" />.</exception>
// Token: 0x06003B43 RID: 15171 RVA: 0x000E1EE5 File Offset: 0x000E00E5
[__DynamicallyInvokable]
public int LastIndexOf(T item, int index)
{
if (index >= this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_Index);
}
return this.LastIndexOf(item, index, index + 1);
}
/// <summary>Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that contains the specified number of elements and ends at the specified index.</summary>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.List`1" />. The value can be <see langword="null" /> for reference types.</param>
/// <param name="index">The zero-based starting index of the backward search.</param>
/// <param name="count">The number of elements in the section to search.</param>
/// <returns>The zero-based index of the last occurrence of <paramref name="item" /> within the range of elements in the <see cref="T:System.Collections.Generic.List`1" /> that contains <paramref name="count" /> number of elements and ends at <paramref name="index" />, if found; otherwise, -1.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is outside the range of valid indexes for the <see cref="T:System.Collections.Generic.List`1" />.
/// -or-
/// <paramref name="count" /> is less than 0.
/// -or-
/// <paramref name="index" /> and <paramref name="count" /> do not specify a valid section in the <see cref="T:System.Collections.Generic.List`1" />.</exception>
// Token: 0x06003B44 RID: 15172 RVA: 0x000E1F04 File Offset: 0x000E0104
[__DynamicallyInvokable]
public int LastIndexOf(T item, int index, int count)
{
if (this.Count != 0 && index < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (this.Count != 0 && count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (this._size == 0)
{
return -1;
}
if (index >= this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_BiggerThanCollection);
}
if (count > index + 1)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_BiggerThanCollection);
}
return Array.LastIndexOf<T>(this._items, item, index, count);
}
/// <summary>Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.List`1" />. The value can be <see langword="null" /> for reference types.</param>
/// <returns>
/// <see langword="true" /> if <paramref name="item" /> is successfully removed; otherwise, <see langword="false" />. This method also returns <see langword="false" /> if <paramref name="item" /> was not found in the <see cref="T:System.Collections.Generic.List`1" />.</returns>
// Token: 0x06003B45 RID: 15173 RVA: 0x000E1F74 File Offset: 0x000E0174
[__DynamicallyInvokable]
public bool Remove(T item)
{
int num = this.IndexOf(item);
if (num >= 0)
{
this.RemoveAt(num);
return true;
}
return false;
}
/// <summary>Removes the first occurrence of a specific object from the <see cref="T:System.Collections.IList" />.</summary>
/// <param name="item">The object to remove from the <see cref="T:System.Collections.IList" />.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="item" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
// Token: 0x06003B46 RID: 15174 RVA: 0x000E1F97 File Offset: 0x000E0197
[__DynamicallyInvokable]
void IList.Remove(object item)
{
if (List<T>.IsCompatibleObject(item))
{
this.Remove((T)((object)item));
}
}
/// <summary>Removes all the elements that match the conditions defined by the specified predicate.</summary>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions of the elements to remove.</param>
/// <returns>The number of elements removed from the <see cref="T:System.Collections.Generic.List`1" />.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
// Token: 0x06003B47 RID: 15175 RVA: 0x000E1FB0 File Offset: 0x000E01B0
[__DynamicallyInvokable]
public int RemoveAll(Predicate<T> match)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
int num = 0;
while (num < this._size && !match(this._items[num]))
{
num++;
}
if (num >= this._size)
{
return 0;
}
int i = num + 1;
while (i < this._size)
{
while (i < this._size && match(this._items[i]))
{
i++;
}
if (i < this._size)
{
this._items[num++] = this._items[i++];
}
}
Array.Clear(this._items, num, this._size - num);
int result = this._size - num;
this._size = num;
this._version++;
return result;
}
/// <summary>Removes the element at the specified index of the <see cref="T:System.Collections.Generic.List`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 0.
/// -or-
/// <paramref name="index" /> is equal to or greater than <see cref="P:System.Collections.Generic.List`1.Count" />.</exception>
// Token: 0x06003B48 RID: 15176 RVA: 0x000E2084 File Offset: 0x000E0284
[__DynamicallyInvokable]
public void RemoveAt(int index)
{
if (index >= this._size)
{
ThrowHelper.ThrowArgumentOutOfRangeException();
}
this._size--;
if (index < this._size)
{
Array.Copy(this._items, index + 1, this._items, index, this._size - index);
}
this._items[this._size] = default(T);
this._version++;
}
/// <summary>Removes a range of elements from the <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <param name="index">The zero-based starting index of the range of elements to remove.</param>
/// <param name="count">The number of elements to remove.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.
/// -or-
/// <paramref name="count" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="index" /> and <paramref name="count" /> do not denote a valid range of elements in the <see cref="T:System.Collections.Generic.List`1" />.</exception>
// Token: 0x06003B49 RID: 15177 RVA: 0x000E20FC File Offset: 0x000E02FC
[__DynamicallyInvokable]
public void RemoveRange(int index, int count)
{
if (index < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (this._size - index < count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
if (count > 0)
{
int size = this._size;
this._size -= count;
if (index < this._size)
{
Array.Copy(this._items, index + count, this._items, index, this._size - index);
}
Array.Clear(this._items, this._size, count);
this._version++;
}
}
/// <summary>Reverses the order of the elements in the entire <see cref="T:System.Collections.Generic.List`1" />.</summary>
// Token: 0x06003B4A RID: 15178 RVA: 0x000E2192 File Offset: 0x000E0392
[__DynamicallyInvokable]
public void Reverse()
{
this.Reverse(0, this.Count);
}
/// <summary>Reverses the order of the elements in the specified range.</summary>
/// <param name="index">The zero-based starting index of the range to reverse.</param>
/// <param name="count">The number of elements in the range to reverse.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.
/// -or-
/// <paramref name="count" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="index" /> and <paramref name="count" /> do not denote a valid range of elements in the <see cref="T:System.Collections.Generic.List`1" />.</exception>
// Token: 0x06003B4B RID: 15179 RVA: 0x000E21A4 File Offset: 0x000E03A4
[__DynamicallyInvokable]
public void Reverse(int index, int count)
{
if (index < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (this._size - index < count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
Array.Reverse(this._items, index, count);
this._version++;
}
/// <summary>Sorts the elements in the entire <see cref="T:System.Collections.Generic.List`1" /> using the default comparer.</summary>
/// <exception cref="T:System.InvalidOperationException">The default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default" /> cannot find an implementation of the <see cref="T:System.IComparable`1" /> generic interface or the <see cref="T:System.IComparable" /> interface for type <paramref name="T" />.</exception>
// Token: 0x06003B4C RID: 15180 RVA: 0x000E21F6 File Offset: 0x000E03F6
[__DynamicallyInvokable]
public void Sort()
{
this.Sort(0, this.Count, null);
}
/// <summary>Sorts the elements in the entire <see cref="T:System.Collections.Generic.List`1" /> using the specified comparer.</summary>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing elements, or <see langword="null" /> to use the default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default" />.</param>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="comparer" /> is <see langword="null" />, and the default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default" /> cannot find implementation of the <see cref="T:System.IComparable`1" /> generic interface or the <see cref="T:System.IComparable" /> interface for type <paramref name="T" />.</exception>
/// <exception cref="T:System.ArgumentException">The implementation of <paramref name="comparer" /> caused an error during the sort. For example, <paramref name="comparer" /> might not return 0 when comparing an item with itself.</exception>
// Token: 0x06003B4D RID: 15181 RVA: 0x000E2206 File Offset: 0x000E0406
[__DynamicallyInvokable]
public void Sort(IComparer<T> comparer)
{
this.Sort(0, this.Count, comparer);
}
/// <summary>Sorts the elements in a range of elements in <see cref="T:System.Collections.Generic.List`1" /> using the specified comparer.</summary>
/// <param name="index">The zero-based starting index of the range to sort.</param>
/// <param name="count">The length of the range to sort.</param>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing elements, or <see langword="null" /> to use the default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default" />.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.
/// -or-
/// <paramref name="count" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="index" /> and <paramref name="count" /> do not specify a valid range in the <see cref="T:System.Collections.Generic.List`1" />.
/// -or-
/// The implementation of <paramref name="comparer" /> caused an error during the sort. For example, <paramref name="comparer" /> might not return 0 when comparing an item with itself.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="comparer" /> is <see langword="null" />, and the default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default" /> cannot find implementation of the <see cref="T:System.IComparable`1" /> generic interface or the <see cref="T:System.IComparable" /> interface for type <paramref name="T" />.</exception>
// Token: 0x06003B4E RID: 15182 RVA: 0x000E2218 File Offset: 0x000E0418
[__DynamicallyInvokable]
public void Sort(int index, int count, IComparer<T> comparer)
{
if (index < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (this._size - index < count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
Array.Sort<T>(this._items, index, count, comparer);
this._version++;
}
/// <summary>Sorts the elements in the entire <see cref="T:System.Collections.Generic.List`1" /> using the specified <see cref="T:System.Comparison`1" />.</summary>
/// <param name="comparison">The <see cref="T:System.Comparison`1" /> to use when comparing elements.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="comparison" /> is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentException">The implementation of <paramref name="comparison" /> caused an error during the sort. For example, <paramref name="comparison" /> might not return 0 when comparing an item with itself.</exception>
// Token: 0x06003B4F RID: 15183 RVA: 0x000E226C File Offset: 0x000E046C
[__DynamicallyInvokable]
public void Sort(Comparison<T> comparison)
{
if (comparison == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
if (this._size > 0)
{
IComparer<T> comparer = new Array.FunctorComparer<T>(comparison);
Array.Sort<T>(this._items, 0, this._size, comparer);
}
}
/// <summary>Copies the elements of the <see cref="T:System.Collections.Generic.List`1" /> to a new array.</summary>
/// <returns>An array containing copies of the elements of the <see cref="T:System.Collections.Generic.List`1" />.</returns>
// Token: 0x06003B50 RID: 15184 RVA: 0x000E22A8 File Offset: 0x000E04A8
[__DynamicallyInvokable]
public T[] ToArray()
{
T[] array = new T[this._size];
Array.Copy(this._items, 0, array, 0, this._size);
return array;
}
/// <summary>Sets the capacity to the actual number of elements in the <see cref="T:System.Collections.Generic.List`1" />, if that number is less than a threshold value.</summary>
// Token: 0x06003B51 RID: 15185 RVA: 0x000E22D8 File Offset: 0x000E04D8
[__DynamicallyInvokable]
public void TrimExcess()
{
int num = (int)((double)this._items.Length * 0.9);
if (this._size < num)
{
this.Capacity = this._size;
}
}
/// <summary>Determines whether every element in the <see cref="T:System.Collections.Generic.List`1" /> matches the conditions defined by the specified predicate.</summary>
/// <param name="match">The <see cref="T:System.Predicate`1" /> delegate that defines the conditions to check against the elements.</param>
/// <returns>
/// <see langword="true" /> if every element in the <see cref="T:System.Collections.Generic.List`1" /> matches the conditions defined by the specified predicate; otherwise, <see langword="false" />. If the list has no elements, the return value is <see langword="true" />.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="match" /> is <see langword="null" />.</exception>
// Token: 0x06003B52 RID: 15186 RVA: 0x000E2310 File Offset: 0x000E0510
[__DynamicallyInvokable]
public bool TrueForAll(Predicate<T> match)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
for (int i = 0; i < this._size; i++)
{
if (!match(this._items[i]))
{
return false;
}
}
return true;
}
// Token: 0x06003B53 RID: 15187 RVA: 0x000E234E File Offset: 0x000E054E
internal static IList<T> Synchronized(List<T> list)
{
return new List<T>.SynchronizedList(list);
}
// Token: 0x04001962 RID: 6498
private const int _defaultCapacity = 4;
// Token: 0x04001963 RID: 6499
private T[] _items;
// Token: 0x04001964 RID: 6500
private int _size;
// Token: 0x04001965 RID: 6501
private int _version;
// Token: 0x04001966 RID: 6502
[NonSerialized]
private object _syncRoot;
// Token: 0x04001967 RID: 6503
private static readonly T[] _emptyArray = new T[0];
// Token: 0x02000BDF RID: 3039
[Serializable]
internal class SynchronizedList : IList<T>, ICollection<!0>, IEnumerable<!0>, IEnumerable
{
// Token: 0x06006F4C RID: 28492 RVA: 0x00180430 File Offset: 0x0017E630
internal SynchronizedList(List<T> list)
{
this._list = list;
this._root = ((ICollection)list).SyncRoot;
}
// Token: 0x17001316 RID: 4886
// (get) Token: 0x06006F4D RID: 28493 RVA: 0x0018044C File Offset: 0x0017E64C
public int Count
{
get
{
object root = this._root;
int count;
lock (root)
{
count = this._list.Count;
}
return count;
}
}
// Token: 0x17001317 RID: 4887
// (get) Token: 0x06006F4E RID: 28494 RVA: 0x00180494 File Offset: 0x0017E694
public bool IsReadOnly
{
get
{
return ((ICollection<T>)this._list).IsReadOnly;
}
}
// Token: 0x06006F4F RID: 28495 RVA: 0x001804A4 File Offset: 0x0017E6A4
public void Add(T item)
{
object root = this._root;
lock (root)
{
this._list.Add(item);
}
}
// Token: 0x06006F50 RID: 28496 RVA: 0x001804EC File Offset: 0x0017E6EC
public void Clear()
{
object root = this._root;
lock (root)
{
this._list.Clear();
}
}
// Token: 0x06006F51 RID: 28497 RVA: 0x00180534 File Offset: 0x0017E734
public bool Contains(T item)
{
object root = this._root;
bool result;
lock (root)
{
result = this._list.Contains(item);
}
return result;
}
// Token: 0x06006F52 RID: 28498 RVA: 0x0018057C File Offset: 0x0017E77C
public void CopyTo(T[] array, int arrayIndex)
{
object root = this._root;
lock (root)
{
this._list.CopyTo(array, arrayIndex);
}
}
// Token: 0x06006F53 RID: 28499 RVA: 0x001805C4 File Offset: 0x0017E7C4
public bool Remove(T item)
{
object root = this._root;
bool result;
lock (root)
{
result = this._list.Remove(item);
}
return result;
}
// Token: 0x06006F54 RID: 28500 RVA: 0x0018060C File Offset: 0x0017E80C
IEnumerator IEnumerable.GetEnumerator()
{
object root = this._root;
IEnumerator result;
lock (root)
{
result = this._list.GetEnumerator();
}
return result;
}
// Token: 0x06006F55 RID: 28501 RVA: 0x00180658 File Offset: 0x0017E858
IEnumerator<T> IEnumerable<!0>.GetEnumerator()
{
object root = this._root;
IEnumerator<T> enumerator;
lock (root)
{
enumerator = ((IEnumerable<T>)this._list).GetEnumerator();
}
return enumerator;
}
// Token: 0x17001318 RID: 4888
public T this[int index]
{
get
{
object root = this._root;
T result;
lock (root)
{
result = this._list[index];
}
return result;
}
set
{
object root = this._root;
lock (root)
{
this._list[index] = value;
}
}
}
// Token: 0x06006F58 RID: 28504 RVA: 0x00180730 File Offset: 0x0017E930
public int IndexOf(T item)
{
object root = this._root;
int result;
lock (root)
{
result = this._list.IndexOf(item);
}
return result;
}
// Token: 0x06006F59 RID: 28505 RVA: 0x00180778 File Offset: 0x0017E978
public void Insert(int index, T item)
{
object root = this._root;
lock (root)
{
this._list.Insert(index, item);
}
}
// Token: 0x06006F5A RID: 28506 RVA: 0x001807C0 File Offset: 0x0017E9C0
public void RemoveAt(int index)
{
object root = this._root;
lock (root)
{
this._list.RemoveAt(index);
}
}
// Token: 0x04003601 RID: 13825
private List<T> _list;
// Token: 0x04003602 RID: 13826
private object _root;
}
/// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <typeparam name="T" />
// Token: 0x02000BE0 RID: 3040
[__DynamicallyInvokable]
[Serializable]
public struct Enumerator : IEnumerator<T>, IDisposable, IEnumerator
{
// Token: 0x06006F5B RID: 28507 RVA: 0x00180808 File Offset: 0x0017EA08
internal Enumerator(List<T> list)
{
this.list = list;
this.index = 0;
this.version = list._version;
this.current = default(T);
}
/// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.List`1.Enumerator" />.</summary>
// Token: 0x06006F5C RID: 28508 RVA: 0x00180830 File Offset: 0x0017EA30
[__DynamicallyInvokable]
public void Dispose()
{
}
/// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.List`1" />.</summary>
/// <returns>
/// <see langword="true" /> if the enumerator was successfully advanced to the next element; <see langword="false" /> if the enumerator has passed the end of the collection.</returns>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
// Token: 0x06006F5D RID: 28509 RVA: 0x00180834 File Offset: 0x0017EA34
[__DynamicallyInvokable]
public bool MoveNext()
{
List<T> list = this.list;
if (this.version == list._version && this.index < list._size)
{
this.current = list._items[this.index];
this.index++;
return true;
}
return this.MoveNextRare();
}
// Token: 0x06006F5E RID: 28510 RVA: 0x00180891 File Offset: 0x0017EA91
private bool MoveNextRare()
{
if (this.version != this.list._version)
{
ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumFailedVersion);
}
this.index = this.list._size + 1;
this.current = default(T);
return false;
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the <see cref="T:System.Collections.Generic.List`1" /> at the current position of the enumerator.</returns>
// Token: 0x17001319 RID: 4889
// (get) Token: 0x06006F5F RID: 28511 RVA: 0x001808CD File Offset: 0x0017EACD
[__DynamicallyInvokable]
public T Current
{
[__DynamicallyInvokable]
get
{
return this.current;
}
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the <see cref="T:System.Collections.Generic.List`1" /> at the current position of the enumerator.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element.</exception>
// Token: 0x1700131A RID: 4890
// (get) Token: 0x06006F60 RID: 28512 RVA: 0x001808D5 File Offset: 0x0017EAD5
[__DynamicallyInvokable]
object IEnumerator.Current
{
[__DynamicallyInvokable]
get
{
if (this.index == 0 || this.index == this.list._size + 1)
{
ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumOpCantHappen);
}
return this.Current;
}
}
/// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
// Token: 0x06006F61 RID: 28513 RVA: 0x00180906 File Offset: 0x0017EB06
[__DynamicallyInvokable]
void IEnumerator.Reset()
{
if (this.version != this.list._version)
{
ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumFailedVersion);
}
this.index = 0;
this.current = default(T);
}
// Token: 0x04003603 RID: 13827
private List<T> list;
// Token: 0x04003604 RID: 13828
private int index;
// Token: 0x04003605 RID: 13829
private int version;
// Token: 0x04003606 RID: 13830
private T current;
}
}
}