Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
1898 lines (1670 sloc) 117 KB
<Type Name="CollectionBase" FullName="System.Collections.CollectionBase">
<TypeSignature Language="C#" Value="public abstract class CollectionBase : System.Collections.IList" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract serializable beforefieldinit CollectionBase extends System.Object implements class System.Collections.ICollection, class System.Collections.IEnumerable, class System.Collections.IList" />
<TypeSignature Language="DocId" Value="T:System.Collections.CollectionBase" />
<TypeSignature Language="VB.NET" Value="Public MustInherit Class CollectionBase&#xA;Implements IList" />
<TypeSignature Language="C++ CLI" Value="public ref class CollectionBase abstract : System::Collections::IList" />
<TypeSignature Language="F#" Value="type CollectionBase = class&#xA; interface IList&#xA; interface ICollection&#xA; interface IEnumerable" />
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.Collections.ICollection</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Collections.IEnumerable</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Collections.IList</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0">
<AttributeName>System.Serializable</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Provides the <see langword="abstract" /> base class for a strongly typed collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!IMPORTANT]
> We don't recommend that you use the `CollectionBase` class for new development. Instead, we recommend that you use the generic <xref:System.Collections.ObjectModel.Collection%601> class. For more information, see [Non-generic collections shouldn't be used](https://github.com/dotnet/platform-compat/blob/master/docs/DE0006.md) on GitHub.
A <xref:System.Collections.CollectionBase> instance is always modifiable. See <xref:System.Collections.ReadOnlyCollectionBase> for a read-only version of this class.
The capacity of a <xref:System.Collections.CollectionBase> is the number of elements the <xref:System.Collections.CollectionBase> can hold. As elements are added to a <xref:System.Collections.CollectionBase>, the capacity is automatically increased as required through reallocation. The capacity can be decreased by setting the <xref:System.Collections.CollectionBase.Capacity%2A> property explicitly.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<threadsafe>Public static (<see langword="Shared" /> in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
This implementation does not provide a synchronized (thread safe) wrapper for a <see cref="T:System.Collections.CollectionBase" />, but derived classes can create their own synchronized versions of the <see cref="T:System.Collections.CollectionBase" /> using the <see cref="P:System.Collections.ICollection.SyncRoot" /> property.
Enumerating through a collection is intrinsically not a thread safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.</threadsafe>
<block subset="none" type="overrides">
<para>This base class is provided to make it easier for implementers to create a strongly typed custom collection. Implementers are encouraged to extend this base class instead of creating their own.</para>
</block>
<altmember cref="T:System.Collections.ArrayList" />
<altmember cref="T:System.Collections.IList" />
<altmember cref="T:System.Collections.ReadOnlyCollectionBase" />
<altmember cref="N:System.Collections.Generic" />
<related type="Article" href="~/docs/standard/globalization-localization/performing-culture-insensitive-string-operations.md">Performing Culture-Insensitive String Operations</related>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Collections.CollectionBase" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected CollectionBase ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.#ctor" />
<MemberSignature Language="VB.NET" Value="Protected Sub New ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; CollectionBase();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Collections.CollectionBase" /> class with the default initial capacity.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The capacity of a <xref:System.Collections.CollectionBase> is the number of elements that the <xref:System.Collections.CollectionBase> can hold. As elements are added to a <xref:System.Collections.CollectionBase>, the capacity is automatically increased as required by reallocating the internal array.
If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the <xref:System.Collections.CollectionBase>.
This constructor is an O(1) operation.
]]></format>
</remarks>
<altmember cref="P:System.Collections.CollectionBase.Capacity" />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected CollectionBase (int capacity);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(int32 capacity) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.#ctor(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Protected Sub New (capacity As Integer)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; CollectionBase(int capacity);" />
<MemberSignature Language="F#" Value="new System.Collections.CollectionBase : int -&gt; System.Collections.CollectionBase" Usage="new System.Collections.CollectionBase capacity" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="capacity" Type="System.Int32" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="capacity">The number of elements that the new list can initially store.</param>
<summary>Initializes a new instance of the <see cref="T:System.Collections.CollectionBase" /> class with the specified capacity.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The capacity of a <xref:System.Collections.CollectionBase> is the number of elements that the <xref:System.Collections.CollectionBase> can hold. As elements are added to a <xref:System.Collections.CollectionBase>, the capacity is automatically increased as required by reallocating the internal array.
If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the <xref:System.Collections.CollectionBase>.
This constructor is an O(`n`) operation, where `n` is `capacity`.
]]></format>
</remarks>
<altmember cref="P:System.Collections.CollectionBase.Capacity" />
</Docs>
</Member>
<Member MemberName="Capacity">
<MemberSignature Language="C#" Value="public int Capacity { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 Capacity" />
<MemberSignature Language="DocId" Value="P:System.Collections.CollectionBase.Capacity" />
<MemberSignature Language="VB.NET" Value="Public Property Capacity As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int Capacity { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.Capacity : int with get, set" Usage="System.Collections.CollectionBase.Capacity" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the number of elements that the <see cref="T:System.Collections.CollectionBase" /> can contain.</summary>
<value>The number of elements that the <see cref="T:System.Collections.CollectionBase" /> can contain.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Collections.CollectionBase.Capacity%2A> is the number of elements that the <xref:System.Collections.CollectionBase> can store. <xref:System.Collections.CollectionBase.Count%2A> is the number of elements that are actually in the <xref:System.Collections.CollectionBase>.
<xref:System.Collections.CollectionBase.Capacity%2A> is always greater than or equal to <xref:System.Collections.CollectionBase.Count%2A>. If <xref:System.Collections.CollectionBase.Count%2A> exceeds <xref:System.Collections.CollectionBase.Capacity%2A> while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements.
The capacity can be decreased by setting the <xref:System.Collections.CollectionBase.Capacity%2A> property explicitly. When the value of <xref:System.Collections.CollectionBase.Capacity%2A> is set explicitly, the internal array is also reallocated to accommodate the specified capacity.
Retrieving the value of this property is an O(1) operation; setting the property is an O(`n`) operation, where `n` is the new capacity.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<see cref="P:System.Collections.CollectionBase.Capacity" /> is set to a value that is less than <see cref="P:System.Collections.CollectionBase.Count" />.</exception>
<exception cref="T:System.OutOfMemoryException">There is not enough memory available on the system.</exception>
<altmember cref="P:System.Collections.CollectionBase.Count" />
</Docs>
</Member>
<Member MemberName="Clear">
<MemberSignature Language="C#" Value="public void Clear ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Clear() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.Clear" />
<MemberSignature Language="VB.NET" Value="Public Sub Clear ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void Clear();" />
<MemberSignature Language="F#" Value="abstract member Clear : unit -&gt; unit&#xA;override this.Clear : unit -&gt; unit" Usage="collectionBase.Clear " />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IList.Clear</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Removes all objects from the <see cref="T:System.Collections.CollectionBase" /> instance. This method cannot be overridden.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Collections.CollectionBase.Count%2A> is set to zero.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.CollectionBase.Count%2A>.
To perform custom actions before or after the collection is cleared, override the protected <xref:System.Collections.CollectionBase.OnClear%2A> or <xref:System.Collections.CollectionBase.OnClearComplete%2A> method.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Count">
<MemberSignature Language="C#" Value="public int Count { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 Count" />
<MemberSignature Language="DocId" Value="P:System.Collections.CollectionBase.Count" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Count As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int Count { int get(); };" />
<MemberSignature Language="F#" Value="member this.Count : int" Usage="System.Collections.CollectionBase.Count" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.ICollection.Count</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the number of elements contained in the <see cref="T:System.Collections.CollectionBase" /> instance. This property cannot be overridden.</summary>
<value>The number of elements contained in the <see cref="T:System.Collections.CollectionBase" /> instance.
Retrieving the value of this property is an O(1) operation.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="GetEnumerator">
<MemberSignature Language="C#" Value="public System.Collections.IEnumerator GetEnumerator ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Collections.IEnumerator GetEnumerator() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.GetEnumerator" />
<MemberSignature Language="VB.NET" Value="Public Function GetEnumerator () As IEnumerator" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual System::Collections::IEnumerator ^ GetEnumerator();" />
<MemberSignature Language="F#" Value="abstract member GetEnumerator : unit -&gt; System.Collections.IEnumerator&#xA;override this.GetEnumerator : unit -&gt; System.Collections.IEnumerator" Usage="collectionBase.GetEnumerator " />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IEnumerable.GetEnumerator</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.IEnumerator</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.CollectionBase" /> instance.</summary>
<returns>An <see cref="T:System.Collections.IEnumerator" /> for the <see cref="T:System.Collections.CollectionBase" /> instance.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
[Visual Basic, C#]
The `foreach` statement of the C# language (`for each` in Visual Basic) hides the complexity of the enumerators. Therefore, using `foreach` is recommended, instead of directly manipulating the enumerator.
Enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection.
Initially, the enumerator is positioned before the first element in the collection. <xref:System.Collections.IEnumerator.Reset%2A> also brings the enumerator back to this position. At this position, calling <xref:System.Collections.IEnumerator.Current%2A> throws an exception. Therefore, you must call <xref:System.Collections.IEnumerator.MoveNext%2A> to advance the enumerator to the first element of the collection before reading the value of <xref:System.Collections.IEnumerator.Current%2A>.
<xref:System.Collections.IEnumerator.Current%2A> returns the same object until either <xref:System.Collections.IEnumerator.MoveNext%2A> or <xref:System.Collections.IEnumerator.Reset%2A> is called. <xref:System.Collections.IEnumerator.MoveNext%2A> sets <xref:System.Collections.IEnumerator.Current%2A> to the next element.
If <xref:System.Collections.IEnumerator.MoveNext%2A> passes the end of the collection, the enumerator is positioned after the last element in the collection and <xref:System.Collections.IEnumerator.MoveNext%2A> returns `false`. When the enumerator is at this position, subsequent calls to <xref:System.Collections.IEnumerator.MoveNext%2A> also return `false`. If the last call to <xref:System.Collections.IEnumerator.MoveNext%2A> returned `false`, calling <xref:System.Collections.IEnumerator.Current%2A> throws an exception. To set <xref:System.Collections.IEnumerator.Current%2A> to the first element of the collection again, you can call <xref:System.Collections.IEnumerator.Reset%2A> followed by <xref:System.Collections.IEnumerator.MoveNext%2A>.
An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to <xref:System.Collections.IEnumerator.MoveNext%2A> or <xref:System.Collections.IEnumerator.Reset%2A> throws an <xref:System.InvalidOperationException>. If the collection is modified between <xref:System.Collections.IEnumerator.MoveNext%2A> and <xref:System.Collections.IEnumerator.Current%2A>, <xref:System.Collections.IEnumerator.Current%2A> returns the element that it is set to, even if the enumerator is already invalidated.
The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.
While the <xref:System.Collections.CollectionBase.GetEnumerator%2A> method is not visible to COM clients by default, inheriting the <xref:System.Collections.CollectionBase> class can expose it and can cause undesirable behavior in COM clients.
This method is an O(1) operation.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Collections.IEnumerator" />
</Docs>
</Member>
<Member MemberName="InnerList">
<MemberSignature Language="C#" Value="protected System.Collections.ArrayList InnerList { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ArrayList InnerList" />
<MemberSignature Language="DocId" Value="P:System.Collections.CollectionBase.InnerList" />
<MemberSignature Language="VB.NET" Value="Protected ReadOnly Property InnerList As ArrayList" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; property System::Collections::ArrayList ^ InnerList { System::Collections::ArrayList ^ get(); };" />
<MemberSignature Language="F#" Value="member this.InnerList : System.Collections.ArrayList" Usage="System.Collections.CollectionBase.InnerList" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.ArrayList</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets an <see cref="T:System.Collections.ArrayList" /> containing the list of elements in the <see cref="T:System.Collections.CollectionBase" /> instance.</summary>
<value>An <see cref="T:System.Collections.ArrayList" /> representing the <see cref="T:System.Collections.CollectionBase" /> instance itself.
Retrieving the value of this property is an O(1) operation.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The On* methods are invoked only on the instance returned by the <xref:System.Collections.CollectionBase.List%2A> property, but not on the instance returned by the <xref:System.Collections.CollectionBase.InnerList%2A> property.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="List">
<MemberSignature Language="C#" Value="protected System.Collections.IList List { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.IList List" />
<MemberSignature Language="DocId" Value="P:System.Collections.CollectionBase.List" />
<MemberSignature Language="VB.NET" Value="Protected ReadOnly Property List As IList" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; property System::Collections::IList ^ List { System::Collections::IList ^ get(); };" />
<MemberSignature Language="F#" Value="member this.List : System.Collections.IList" Usage="System.Collections.CollectionBase.List" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.IList</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets an <see cref="T:System.Collections.IList" /> containing the list of elements in the <see cref="T:System.Collections.CollectionBase" /> instance.</summary>
<value>An <see cref="T:System.Collections.IList" /> representing the <see cref="T:System.Collections.CollectionBase" /> instance itself.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The On* methods are invoked only on the instance returned by the <xref:System.Collections.CollectionBase.List%2A> property, but not on the instance returned by the <xref:System.Collections.CollectionBase.InnerList%2A> property.
Retrieving the value of this property is an O(1) operation.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="OnClear">
<MemberSignature Language="C#" Value="protected virtual void OnClear ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnClear() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.OnClear" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub OnClear ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void OnClear();" />
<MemberSignature Language="F#" Value="abstract member OnClear : unit -&gt; unit&#xA;override this.OnClear : unit -&gt; unit" Usage="collectionBase.OnClear " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Performs additional custom processes when clearing the contents of the <see cref="T:System.Collections.CollectionBase" /> instance.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action before the collection is cleared.
The On* methods are invoked only on the instance returned by the <xref:System.Collections.CollectionBase.List%2A> property, but not on the instance returned by the <xref:System.Collections.CollectionBase.InnerList%2A> property.
If the process fails, the collection reverts back to its previous state.
The default implementation of this method is an O(1) operation.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>This method allows implementers to define processes that must be performed before deleting all the elements from the underlying <see cref="T:System.Collections.ArrayList" />. By defining this method, implementers can add functionality to inherited methods without having to override all other methods.
<see cref="M:System.Collections.CollectionBase.OnClear" /> is invoked before the standard Clear behavior, whereas <see cref="M:System.Collections.CollectionBase.OnClearComplete" /> is invoked after the standard Clear behavior.
For example, implementers can exempt certain elements from deletion by a global Clear.</para>
</block>
<altmember cref="M:System.Collections.CollectionBase.OnClearComplete" />
<altmember cref="M:System.Collections.CollectionBase.OnRemove(System.Int32,System.Object)" />
</Docs>
</Member>
<Member MemberName="OnClearComplete">
<MemberSignature Language="C#" Value="protected virtual void OnClearComplete ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnClearComplete() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.OnClearComplete" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub OnClearComplete ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void OnClearComplete();" />
<MemberSignature Language="F#" Value="abstract member OnClearComplete : unit -&gt; unit&#xA;override this.OnClearComplete : unit -&gt; unit" Usage="collectionBase.OnClearComplete " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Performs additional custom processes after clearing the contents of the <see cref="T:System.Collections.CollectionBase" /> instance.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action after the collection is cleared.
The On* methods are invoked only on the instance returned by the <xref:System.Collections.CollectionBase.List%2A> property, but not on the instance returned by the <xref:System.Collections.CollectionBase.InnerList%2A> property.
The default implementation of this method is an O(1) operation.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>This method allows implementers to define processes that must be performed after deleting all the elements from the underlying <see cref="T:System.Collections.ArrayList" />. By defining this method, implementers can add functionality to inherited methods without having to override all other methods.
<see cref="M:System.Collections.CollectionBase.OnClear" /> is invoked before the standard Clear behavior, whereas <see cref="M:System.Collections.CollectionBase.OnClearComplete" /> is invoked after the standard Clear behavior.</para>
</block>
<altmember cref="M:System.Collections.CollectionBase.OnClear" />
<altmember cref="M:System.Collections.CollectionBase.OnRemoveComplete(System.Int32,System.Object)" />
</Docs>
</Member>
<Member MemberName="OnInsert">
<MemberSignature Language="C#" Value="protected virtual void OnInsert (int index, object value);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnInsert(int32 index, object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.OnInsert(System.Int32,System.Object)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub OnInsert (index As Integer, value As Object)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void OnInsert(int index, System::Object ^ value);" />
<MemberSignature Language="F#" Value="abstract member OnInsert : int * obj -&gt; unit&#xA;override this.OnInsert : int * obj -&gt; unit" Usage="collectionBase.OnInsert (index, value)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="index">The zero-based index at which to insert <paramref name="value" />.</param>
<param name="value">The new value of the element at <paramref name="index" />.</param>
<summary>Performs additional custom processes before inserting a new element into the <see cref="T:System.Collections.CollectionBase" /> instance.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action before the specified element is inserted.
The On* methods are invoked only on the instance returned by the <xref:System.Collections.CollectionBase.List%2A> property, but not on the instance returned by the <xref:System.Collections.CollectionBase.InnerList%2A> property.
If the process fails, the collection reverts back to its previous state.
The default implementation of this method is an O(1) operation.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>This method allows implementers to define processes that must be performed before inserting the element into the underlying <see cref="T:System.Collections.ArrayList" />. By defining this method, implementers can add functionality to inherited methods without having to override all other methods.
<see cref="M:System.Collections.CollectionBase.OnInsert(System.Int32,System.Object)" /> is invoked before the standard Insert behavior, whereas <see cref="M:System.Collections.CollectionBase.OnInsertComplete(System.Int32,System.Object)" /> is invoked after the standard Insert behavior.
For example, implementers can restrict which types of objects can be inserted into the <see cref="T:System.Collections.ArrayList" />.
<see cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" /> is called prior to this method.</para>
</block>
<altmember cref="M:System.Collections.CollectionBase.OnInsertComplete(System.Int32,System.Object)" />
<altmember cref="M:System.Collections.CollectionBase.OnSet(System.Int32,System.Object,System.Object)" />
<altmember cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" />
</Docs>
</Member>
<Member MemberName="OnInsertComplete">
<MemberSignature Language="C#" Value="protected virtual void OnInsertComplete (int index, object value);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnInsertComplete(int32 index, object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.OnInsertComplete(System.Int32,System.Object)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub OnInsertComplete (index As Integer, value As Object)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void OnInsertComplete(int index, System::Object ^ value);" />
<MemberSignature Language="F#" Value="abstract member OnInsertComplete : int * obj -&gt; unit&#xA;override this.OnInsertComplete : int * obj -&gt; unit" Usage="collectionBase.OnInsertComplete (index, value)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="index">The zero-based index at which to insert <paramref name="value" />.</param>
<param name="value">The new value of the element at <paramref name="index" />.</param>
<summary>Performs additional custom processes after inserting a new element into the <see cref="T:System.Collections.CollectionBase" /> instance.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action after the specified element is inserted.
The On* methods are invoked only on the instance returned by the <xref:System.Collections.CollectionBase.List%2A> property, but not on the instance returned by the <xref:System.Collections.CollectionBase.InnerList%2A> property.
The collection reverts back to its previous state if one of the following occurs:
- The process fails.
- This method is overridden to throw an exception.
The default implementation of this method is an O(1) operation.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>This method allows implementers to define processes that must be performed after inserting the element into the underlying <see cref="T:System.Collections.ArrayList" />. By defining this method, implementers can add functionality to inherited methods without having to override all other methods.
<see cref="M:System.Collections.CollectionBase.OnInsert(System.Int32,System.Object)" /> is invoked before the standard Insert behavior, whereas <see cref="M:System.Collections.CollectionBase.OnInsertComplete(System.Int32,System.Object)" /> is invoked after the standard Insert behavior.</para>
</block>
<altmember cref="M:System.Collections.CollectionBase.OnInsert(System.Int32,System.Object)" />
<altmember cref="M:System.Collections.CollectionBase.OnSetComplete(System.Int32,System.Object,System.Object)" />
</Docs>
</Member>
<Member MemberName="OnRemove">
<MemberSignature Language="C#" Value="protected virtual void OnRemove (int index, object value);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnRemove(int32 index, object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.OnRemove(System.Int32,System.Object)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub OnRemove (index As Integer, value As Object)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void OnRemove(int index, System::Object ^ value);" />
<MemberSignature Language="F#" Value="abstract member OnRemove : int * obj -&gt; unit&#xA;override this.OnRemove : int * obj -&gt; unit" Usage="collectionBase.OnRemove (index, value)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="index">The zero-based index at which <paramref name="value" /> can be found.</param>
<param name="value">The value of the element to remove from <paramref name="index" />.</param>
<summary>Performs additional custom processes when removing an element from the <see cref="T:System.Collections.CollectionBase" /> instance.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action before the specified element is removed.
The On* methods are invoked only on the instance returned by the <xref:System.Collections.CollectionBase.List%2A> property, but not on the instance returned by the <xref:System.Collections.CollectionBase.InnerList%2A> property.
If the process fails, the collection reverts back to its previous state.
The default implementation of this method is an O(1) operation.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>This method allows implementers to define processes that must be performed before removing the element from the underlying <see cref="T:System.Collections.ArrayList" />. By defining this method, implementers can add functionality to inherited methods without having to override all other methods.
<see cref="M:System.Collections.CollectionBase.OnRemove(System.Int32,System.Object)" /> is invoked before the standard Remove behavior, whereas <see cref="M:System.Collections.CollectionBase.OnRemoveComplete(System.Int32,System.Object)" /> is invoked after the standard Remove behavior.
For example, implementers can prevent removal of elements by always throwing an exception in <see cref="M:System.Collections.CollectionBase.OnRemove(System.Int32,System.Object)" />.
<see cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" /> is called prior to this method.</para>
</block>
<altmember cref="M:System.Collections.CollectionBase.OnRemoveComplete(System.Int32,System.Object)" />
<altmember cref="M:System.Collections.CollectionBase.OnClear" />
</Docs>
</Member>
<Member MemberName="OnRemoveComplete">
<MemberSignature Language="C#" Value="protected virtual void OnRemoveComplete (int index, object value);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnRemoveComplete(int32 index, object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.OnRemoveComplete(System.Int32,System.Object)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub OnRemoveComplete (index As Integer, value As Object)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void OnRemoveComplete(int index, System::Object ^ value);" />
<MemberSignature Language="F#" Value="abstract member OnRemoveComplete : int * obj -&gt; unit&#xA;override this.OnRemoveComplete : int * obj -&gt; unit" Usage="collectionBase.OnRemoveComplete (index, value)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="index">The zero-based index at which <paramref name="value" /> can be found.</param>
<param name="value">The value of the element to remove from <paramref name="index" />.</param>
<summary>Performs additional custom processes after removing an element from the <see cref="T:System.Collections.CollectionBase" /> instance.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action after the specified element is removed.
The On* methods are invoked only on the instance returned by the <xref:System.Collections.CollectionBase.List%2A> property, but not on the instance returned by the <xref:System.Collections.CollectionBase.InnerList%2A> property.
The collection reverts back to its previous state if one of the following occurs:
- The process fails.
- This method is overridden to throw an exception.
The default implementation of this method is an O(1) operation.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>This method allows implementers to define processes that must be performed after removing the element from the underlying <see cref="T:System.Collections.ArrayList" />. By defining this method, implementers can add functionality to inherited methods without having to override all other methods.
<see cref="M:System.Collections.CollectionBase.OnRemove(System.Int32,System.Object)" /> is invoked before the standard Remove behavior, whereas <see cref="M:System.Collections.CollectionBase.OnRemoveComplete(System.Int32,System.Object)" /> is invoked after the standard Remove behavior.</para>
</block>
<altmember cref="M:System.Collections.CollectionBase.OnRemove(System.Int32,System.Object)" />
<altmember cref="M:System.Collections.CollectionBase.OnClearComplete" />
</Docs>
</Member>
<Member MemberName="OnSet">
<MemberSignature Language="C#" Value="protected virtual void OnSet (int index, object oldValue, object newValue);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnSet(int32 index, object oldValue, object newValue) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.OnSet(System.Int32,System.Object,System.Object)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub OnSet (index As Integer, oldValue As Object, newValue As Object)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void OnSet(int index, System::Object ^ oldValue, System::Object ^ newValue);" />
<MemberSignature Language="F#" Value="abstract member OnSet : int * obj * obj -&gt; unit&#xA;override this.OnSet : int * obj * obj -&gt; unit" Usage="collectionBase.OnSet (index, oldValue, newValue)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="oldValue" Type="System.Object" />
<Parameter Name="newValue" Type="System.Object" />
</Parameters>
<Docs>
<param name="index">The zero-based index at which <paramref name="oldValue" /> can be found.</param>
<param name="oldValue">The value to replace with <paramref name="newValue" />.</param>
<param name="newValue">The new value of the element at <paramref name="index" />.</param>
<summary>Performs additional custom processes before setting a value in the <see cref="T:System.Collections.CollectionBase" /> instance.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action before the specified element is set.
The On* methods are invoked only on the instance returned by the <xref:System.Collections.CollectionBase.List%2A> property, but not on the instance returned by the <xref:System.Collections.CollectionBase.InnerList%2A> property.
If the process fails, the collection reverts back to its previous state.
The default implementation of this method is an O(1) operation.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>This method allows implementers to define processes that must be performed before setting the specified element in the underlying <see cref="T:System.Collections.ArrayList" />. By defining this method, implementers can add functionality to inherited methods without having to override all other methods.
<see cref="M:System.Collections.CollectionBase.OnSet(System.Int32,System.Object,System.Object)" /> is invoked before the standard Set behavior, whereas <see cref="M:System.Collections.CollectionBase.OnSetComplete(System.Int32,System.Object,System.Object)" /> is invoked after the standard Set behavior.
For example, implementers can restrict which values can be overwritten by performing a check inside <see cref="M:System.Collections.CollectionBase.OnSet(System.Int32,System.Object,System.Object)" />.
<see cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" /> is called prior to this method.</para>
</block>
<altmember cref="M:System.Collections.CollectionBase.OnSetComplete(System.Int32,System.Object,System.Object)" />
<altmember cref="M:System.Collections.CollectionBase.OnInsert(System.Int32,System.Object)" />
<altmember cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" />
</Docs>
</Member>
<Member MemberName="OnSetComplete">
<MemberSignature Language="C#" Value="protected virtual void OnSetComplete (int index, object oldValue, object newValue);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnSetComplete(int32 index, object oldValue, object newValue) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.OnSetComplete(System.Int32,System.Object,System.Object)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub OnSetComplete (index As Integer, oldValue As Object, newValue As Object)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void OnSetComplete(int index, System::Object ^ oldValue, System::Object ^ newValue);" />
<MemberSignature Language="F#" Value="abstract member OnSetComplete : int * obj * obj -&gt; unit&#xA;override this.OnSetComplete : int * obj * obj -&gt; unit" Usage="collectionBase.OnSetComplete (index, oldValue, newValue)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="oldValue" Type="System.Object" />
<Parameter Name="newValue" Type="System.Object" />
</Parameters>
<Docs>
<param name="index">The zero-based index at which <paramref name="oldValue" /> can be found.</param>
<param name="oldValue">The value to replace with <paramref name="newValue" />.</param>
<param name="newValue">The new value of the element at <paramref name="index" />.</param>
<summary>Performs additional custom processes after setting a value in the <see cref="T:System.Collections.CollectionBase" /> instance.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action after the specified element is set.
The On* methods are invoked only on the instance returned by the <xref:System.Collections.CollectionBase.List%2A> property, but not on the instance returned by the <xref:System.Collections.CollectionBase.InnerList%2A> property.
The collection reverts back to its previous state if one of the following occurs:
- The process fails.
- This method is overridden to throw an exception.
The default implementation of this method is an O(1) operation.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>This method allows implementers to define processes that must be performed after setting the specified element in the underlying <see cref="T:System.Collections.ArrayList" />. By defining this method, implementers can add functionality to inherited methods without having to override all other methods.
<see cref="M:System.Collections.CollectionBase.OnSet(System.Int32,System.Object,System.Object)" /> is invoked before the standard Set behavior, whereas <see cref="M:System.Collections.CollectionBase.OnSetComplete(System.Int32,System.Object,System.Object)" /> is invoked after the standard Set behavior.</para>
</block>
<altmember cref="M:System.Collections.CollectionBase.OnSet(System.Int32,System.Object,System.Object)" />
<altmember cref="M:System.Collections.CollectionBase.OnInsertComplete(System.Int32,System.Object)" />
</Docs>
</Member>
<Member MemberName="OnValidate">
<MemberSignature Language="C#" Value="protected virtual void OnValidate (object value);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnValidate(object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.OnValidate(System.Object)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub OnValidate (value As Object)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void OnValidate(System::Object ^ value);" />
<MemberSignature Language="F#" Value="abstract member OnValidate : obj -&gt; unit&#xA;override this.OnValidate : obj -&gt; unit" Usage="collectionBase.OnValidate value" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">The object to validate.</param>
<summary>Performs additional custom processes when validating a value.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default implementation of this method determines whether `value` is `null`, and, if so, throws <xref:System.ArgumentNullException>. It is intended to be overridden by a derived class to perform additional action when the specified element is validated.
The On* methods are invoked only on the instance returned by the <xref:System.Collections.CollectionBase.List%2A> property, but not on the instance returned by the <xref:System.Collections.CollectionBase.InnerList%2A> property.
The default implementation of this method is an O(1) operation.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="value" /> is <see langword="null" />.</exception>
<block subset="none" type="overrides">
<para>This method allows implementers to define processes that must be performed when executing the standard behavior of the underlying <see cref="T:System.Collections.ArrayList" />. By defining this method, implementers can add functionality to inherited methods without having to override all other methods.
<see cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" /> can be used to impose restrictions on the type of objects that are accepted into the collection. The default implementation prevents <see langword="null" /> from being added to or removed from the underlying <see cref="T:System.Collections.ArrayList" />.
<see cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" /> is called prior to <see cref="M:System.Collections.CollectionBase.OnInsert(System.Int32,System.Object)" />, <see cref="M:System.Collections.CollectionBase.OnRemove(System.Int32,System.Object)" />, and <see cref="M:System.Collections.CollectionBase.OnSet(System.Int32,System.Object,System.Object)" />.</para>
</block>
<altmember cref="M:System.Collections.CollectionBase.OnSet(System.Int32,System.Object,System.Object)" />
<altmember cref="M:System.Collections.CollectionBase.OnInsert(System.Int32,System.Object)" />
</Docs>
</Member>
<Member MemberName="RemoveAt">
<MemberSignature Language="C#" Value="public void RemoveAt (int index);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void RemoveAt(int32 index) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.RemoveAt(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Sub RemoveAt (index As Integer)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void RemoveAt(int index);" />
<MemberSignature Language="F#" Value="abstract member RemoveAt : int -&gt; unit&#xA;override this.RemoveAt : int -&gt; unit" Usage="collectionBase.RemoveAt index" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IList.RemoveAt(System.Int32)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
</Parameters>
<Docs>
<param name="index">The zero-based index of the element to remove.</param>
<summary>Removes the element at the specified index of the <see cref="T:System.Collections.CollectionBase" /> instance. This method is not overridable.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
In collections of contiguous elements, such as lists, the elements that follow the removed element move up to occupy the vacated spot. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.CollectionBase.Count%2A>.
]]></format>
</remarks>
<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.CollectionBase.Count" />.</exception>
<block subset="none" type="overrides">
<para>This method calls <see cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" />, <see cref="M:System.Collections.CollectionBase.OnRemove(System.Int32,System.Object)" />, and <see cref="M:System.Collections.CollectionBase.OnRemoveComplete(System.Int32,System.Object)" />.</para>
</block>
</Docs>
</Member>
<Member MemberName="System.Collections.ICollection.CopyTo">
<MemberSignature Language="C#" Value="void ICollection.CopyTo (Array array, int index);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Collections.ICollection.CopyTo(class System.Array array, int32 index) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.System#Collections#ICollection#CopyTo(System.Array,System.Int32)" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.Collections.ICollection.CopyTo(Array ^ array, int index) = System::Collections::ICollection::CopyTo;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.ICollection.CopyTo(System.Array,System.Int32)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="array" Type="System.Array" />
<Parameter Name="index" Type="System.Int32" />
</Parameters>
<Docs>
<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.CollectionBase" />. 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>
<summary>Copies the entire <see cref="T:System.Collections.CollectionBase" /> to a compatible one-dimensional <see cref="T:System.Array" />, starting at the specified index of the target array.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The specified array must be of a compatible type.
This method uses <xref:System.Array.Copy%2A?displayProperty=nameWithType> to copy the elements.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.CollectionBase.Count%2A>.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="array" /> is <see langword="null" />.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="index" /> is less than zero.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="array" /> is multidimensional.
-or-
The number of elements in the source <see cref="T:System.Collections.CollectionBase" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
<exception cref="T:System.InvalidCastException">The type of the source <see cref="T:System.Collections.CollectionBase" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
</Docs>
</Member>
<Member MemberName="System.Collections.ICollection.IsSynchronized">
<MemberSignature Language="C#" Value="bool System.Collections.ICollection.IsSynchronized { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool System.Collections.ICollection.IsSynchronized" />
<MemberSignature Language="DocId" Value="P:System.Collections.CollectionBase.System#Collections#ICollection#IsSynchronized" />
<MemberSignature Language="VB.NET" Value=" ReadOnly Property IsSynchronized As Boolean Implements ICollection.IsSynchronized" />
<MemberSignature Language="C++ CLI" Value="property bool System::Collections::ICollection::IsSynchronized { bool get(); };" />
<MemberSignature Language="F#" Usage="System.Collections.ICollection.IsSynchronized" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.ICollection.IsSynchronized</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether access to the <see cref="T:System.Collections.CollectionBase" /> is synchronized (thread safe).</summary>
<value>
<see langword="true" /> if access to the <see cref="T:System.Collections.CollectionBase" /> is synchronized (thread safe); otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A <xref:System.Collections.CollectionBase> instance is not synchronized. Derived classes can provide a synchronized version of the <xref:System.Collections.CollectionBase> using the <xref:System.Collections.ICollection.SyncRoot%2A> property.
Enumerating through a collection is intrinsically not a thread safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.
The following code example shows how to lock the collection using the <xref:System.Collections.ICollection.SyncRoot%2A> during the entire enumeration:
[!code-cpp[System.Collections.CollectionBase#2](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp#2)]
[!code-csharp[System.Collections.CollectionBase#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/remarks.cs#2)]
[!code-vb[System.Collections.CollectionBase#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/remarks.vb#2)]
Retrieving the value of this property is an O(1) operation.
]]></format>
</remarks>
<altmember cref="P:System.Collections.ICollection.SyncRoot" />
</Docs>
</Member>
<Member MemberName="System.Collections.ICollection.SyncRoot">
<MemberSignature Language="C#" Value="object System.Collections.ICollection.SyncRoot { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance object System.Collections.ICollection.SyncRoot" />
<MemberSignature Language="DocId" Value="P:System.Collections.CollectionBase.System#Collections#ICollection#SyncRoot" />
<MemberSignature Language="VB.NET" Value=" ReadOnly Property SyncRoot As Object Implements ICollection.SyncRoot" />
<MemberSignature Language="C++ CLI" Value="property System::Object ^ System::Collections::ICollection::SyncRoot { System::Object ^ get(); };" />
<MemberSignature Language="F#" Usage="System.Collections.ICollection.SyncRoot" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.ICollection.SyncRoot</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.CollectionBase" />.</summary>
<value>An object that can be used to synchronize access to the <see cref="T:System.Collections.CollectionBase" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Derived classes can provide their own synchronized version of the <xref:System.Collections.CollectionBase> using the <xref:System.Collections.ICollection.SyncRoot%2A> property. The synchronizing code must perform operations on the <xref:System.Collections.ICollection.SyncRoot%2A> of the <xref:System.Collections.CollectionBase>, not directly on the <xref:System.Collections.CollectionBase>. This ensures proper operation of collections that are derived from other objects. Specifically, it maintains proper synchronization with other threads that might be simultaneously modifying the <xref:System.Collections.CollectionBase> object.
Enumerating through a collection is intrinsically not a thread safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.
The following code example shows how to lock the collection using the <xref:System.Collections.ICollection.SyncRoot%2A> during the entire enumeration:
[!code-cpp[System.Collections.CollectionBase#2](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp#2)]
[!code-csharp[System.Collections.CollectionBase#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/remarks.cs#2)]
[!code-vb[System.Collections.CollectionBase#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/remarks.vb#2)]
Retrieving the value of this property is an O(1) operation.
]]></format>
</remarks>
<altmember cref="P:System.Collections.ICollection.IsSynchronized" />
</Docs>
</Member>
<Member MemberName="System.Collections.IList.Add">
<MemberSignature Language="C#" Value="int IList.Add (object value);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance int32 System.Collections.IList.Add(object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.System#Collections#IList#Add(System.Object)" />
<MemberSignature Language="VB.NET" Value="Function Add (value As Object) As Integer Implements IList.Add" />
<MemberSignature Language="C++ CLI" Value=" virtual int System.Collections.IList.Add(System::Object ^ value) = System::Collections::IList::Add;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IList.Add(System.Object)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">The <see cref="T:System.Object" /> to be added to the end of the <see cref="T:System.Collections.CollectionBase" />.</param>
<summary>Adds an object to the end of the <see cref="T:System.Collections.CollectionBase" />.</summary>
<returns>The <see cref="T:System.Collections.CollectionBase" /> index at which the <paramref name="value" /> has been added.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If <xref:System.Collections.CollectionBase.Count%2A> already equals the capacity, the capacity of the list is doubled by automatically reallocating the internal array and copying the existing elements to the new array before the new element is added.
If <xref:System.Collections.CollectionBase.Count%2A> is less than the capacity, this method is an O(1) operation. If the capacity needs to be increased to accommodate the new element, this method becomes an O(`n`) operation, where `n` is <xref:System.Collections.CollectionBase.Count%2A>.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.CollectionBase" /> is read-only.
-or-
The <see cref="T:System.Collections.CollectionBase" /> has a fixed size.</exception>
<block subset="none" type="overrides">
<para>This method calls <see cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" />, <see cref="M:System.Collections.CollectionBase.OnInsert(System.Int32,System.Object)" />, and <see cref="M:System.Collections.CollectionBase.OnInsertComplete(System.Int32,System.Object)" />.</para>
</block>
<altmember cref="P:System.Collections.CollectionBase.Count" />
<altmember cref="M:System.Collections.IList.Insert(System.Int32,System.Object)" />
<altmember cref="M:System.Collections.IList.Remove(System.Object)" />
</Docs>
</Member>
<Member MemberName="System.Collections.IList.Contains">
<MemberSignature Language="C#" Value="bool IList.Contains (object value);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance bool System.Collections.IList.Contains(object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.System#Collections#IList#Contains(System.Object)" />
<MemberSignature Language="VB.NET" Value="Function Contains (value As Object) As Boolean Implements IList.Contains" />
<MemberSignature Language="C++ CLI" Value=" virtual bool System.Collections.IList.Contains(System::Object ^ value) = System::Collections::IList::Contains;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IList.Contains(System.Object)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">The <see cref="T:System.Object" /> to locate in the <see cref="T:System.Collections.CollectionBase" />.</param>
<summary>Determines whether the <see cref="T:System.Collections.CollectionBase" /> contains a specific element.</summary>
<returns>
<see langword="true" /> if the <see cref="T:System.Collections.CollectionBase" /> contains the specified <paramref name="value" />; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method performs a linear search; therefore, this method is an O(`n`) operation, where `n` is <xref:System.Collections.CollectionBase.Count%2A>.
This method determines equality by calling <xref:System.Object.Equals%2A?displayProperty=nameWithType>.
Starting with the .NET Framework 2.0, this method uses the collection's objects' <xref:System.Object.Equals%2A> and <xref:System.IComparable.CompareTo%2A> methods on `item` to determine whether `item` exists. In the earlier versions of the .NET Framework, this determination was made by using the <xref:System.Object.Equals%2A> and <xref:System.IComparable.CompareTo%2A> methods of the `item` parameter on the objects in the collection.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<altmember cref="M:System.Collections.IList.IndexOf(System.Object)" />
<related type="Article" href="~/docs/standard/globalization-localization/performing-culture-insensitive-string-operations.md">Performing Culture-Insensitive String Operations</related>
</Docs>
</Member>
<Member MemberName="System.Collections.IList.IndexOf">
<MemberSignature Language="C#" Value="int IList.IndexOf (object value);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance int32 System.Collections.IList.IndexOf(object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.System#Collections#IList#IndexOf(System.Object)" />
<MemberSignature Language="VB.NET" Value="Function IndexOf (value As Object) As Integer Implements IList.IndexOf" />
<MemberSignature Language="C++ CLI" Value=" virtual int System.Collections.IList.IndexOf(System::Object ^ value) = System::Collections::IList::IndexOf;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IList.IndexOf(System.Object)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">The <see cref="T:System.Object" /> to locate in the <see cref="T:System.Collections.CollectionBase" />.</param>
<summary>Searches for the specified <see cref="T:System.Object" /> and returns the zero-based index of the first occurrence within the entire <see cref="T:System.Collections.CollectionBase" />.</summary>
<returns>The zero-based index of the first occurrence of <paramref name="value" /> within the entire <see cref="T:System.Collections.CollectionBase" />, if found; otherwise, -1.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method performs a linear search; therefore, this method is an O(`n`) operation, where `n` is <xref:System.Collections.CollectionBase.Count%2A>.
This method determines equality by calling <xref:System.Object.Equals%2A?displayProperty=nameWithType>.
Starting with the .NET Framework 2.0, this method uses the collection's objects' <xref:System.Object.Equals%2A> and <xref:System.IComparable.CompareTo%2A> methods on `item` to determine whether `item` exists. In the earlier versions of the .NET Framework, this determination was made by using the <xref:System.Object.Equals%2A> and <xref:System.IComparable.CompareTo%2A> methods of the `item` parameter on the objects in the collection.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<altmember cref="M:System.Collections.IList.Contains(System.Object)" />
<related type="Article" href="~/docs/standard/globalization-localization/performing-culture-insensitive-string-operations.md">Performing Culture-Insensitive String Operations</related>
</Docs>
</Member>
<Member MemberName="System.Collections.IList.Insert">
<MemberSignature Language="C#" Value="void IList.Insert (int index, object value);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Collections.IList.Insert(int32 index, object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.System#Collections#IList#Insert(System.Int32,System.Object)" />
<MemberSignature Language="VB.NET" Value="Sub Insert (index As Integer, value As Object) Implements IList.Insert" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.Collections.IList.Insert(int index, System::Object ^ value) = System::Collections::IList::Insert;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IList.Insert(System.Int32,System.Object)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<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.</param>
<summary>Inserts an element into the <see cref="T:System.Collections.CollectionBase" /> at the specified index.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If <xref:System.Collections.CollectionBase.Count%2A> already equals the capacity, the capacity of the list is doubled by automatically reallocating the internal array before the new element is inserted.
If `index` is equal to <xref:System.Collections.CollectionBase.Count%2A>, `value` is added to the end of <xref:System.Collections.CollectionBase>.
In collections of contiguous elements, such as lists, the elements that follow the insertion point move down to accommodate the new element. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.CollectionBase.Count%2A>.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="index" /> is less than zero.
-or-
<paramref name="index" /> is greater than <see cref="P:System.Collections.CollectionBase.Count" />.</exception>
<exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.CollectionBase" /> is read-only.
-or-
The <see cref="T:System.Collections.CollectionBase" /> has a fixed size.</exception>
<block subset="none" type="overrides">
<para>This method calls <see cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" />, <see cref="M:System.Collections.CollectionBase.OnInsert(System.Int32,System.Object)" />, and <see cref="M:System.Collections.CollectionBase.OnInsertComplete(System.Int32,System.Object)" />.</para>
</block>
<altmember cref="M:System.Collections.IList.Add(System.Object)" />
<altmember cref="M:System.Collections.IList.Remove(System.Object)" />
</Docs>
</Member>
<Member MemberName="System.Collections.IList.IsFixedSize">
<MemberSignature Language="C#" Value="bool System.Collections.IList.IsFixedSize { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool System.Collections.IList.IsFixedSize" />
<MemberSignature Language="DocId" Value="P:System.Collections.CollectionBase.System#Collections#IList#IsFixedSize" />
<MemberSignature Language="VB.NET" Value=" ReadOnly Property IsFixedSize As Boolean Implements IList.IsFixedSize" />
<MemberSignature Language="C++ CLI" Value="property bool System::Collections::IList::IsFixedSize { bool get(); };" />
<MemberSignature Language="F#" Usage="System.Collections.IList.IsFixedSize" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.IList.IsFixedSize</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the <see cref="T:System.Collections.CollectionBase" /> has a fixed size.</summary>
<value>
<see langword="true" /> if the <see cref="T:System.Collections.CollectionBase" /> has a fixed size; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A collection with a fixed size does not allow the addition or removal of elements after the collection is created, but it allows the modification of existing elements.
A collection with a fixed size is simply a collection with a wrapper that prevents adding and removing elements; therefore, if changes are made to the underlying collection, including the addition or removal of elements, the fixed-size collection reflects those changes.
Retrieving the value of this property is an O(1) operation.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.Collections.IList.IsReadOnly">
<MemberSignature Language="C#" Value="bool System.Collections.IList.IsReadOnly { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool System.Collections.IList.IsReadOnly" />
<MemberSignature Language="DocId" Value="P:System.Collections.CollectionBase.System#Collections#IList#IsReadOnly" />
<MemberSignature Language="VB.NET" Value=" ReadOnly Property IsReadOnly As Boolean Implements IList.IsReadOnly" />
<MemberSignature Language="C++ CLI" Value="property bool System::Collections::IList::IsReadOnly { bool get(); };" />
<MemberSignature Language="F#" Usage="System.Collections.IList.IsReadOnly" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.IList.IsReadOnly</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the <see cref="T:System.Collections.CollectionBase" /> is read-only.</summary>
<value>
<see langword="true" /> if the <see cref="T:System.Collections.CollectionBase" /> is read-only; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A collection that is read-only does not allow the addition, removal, or modification of elements after the collection is created.
A collection that is read-only is simply a collection with a wrapper that prevents modifying the collection; therefore, if changes are made to the underlying collection, the read-only collection reflects those changes.
Retrieving the value of this property is an O(1) operation.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.Collections.IList.Item">
<MemberSignature Language="C#" Value="object System.Collections.IList.Item[int index] { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance object System.Collections.IList.Item(int32)" />
<MemberSignature Language="DocId" Value="P:System.Collections.CollectionBase.System#Collections#IList#Item(System.Int32)" />
<MemberSignature Language="VB.NET" Value=" Property Item(index As Integer) As Object Implements IList.Item" />
<MemberSignature Language="C++ CLI" Value="property System::Object ^ System::Collections::IList::Item[int] { System::Object ^ get(int index); void set(int index, System::Object ^ value); };" />
<MemberSignature Language="F#" Usage="System.Collections.IList.Item" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.IList.Item(System.Int32)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
</Parameters>
<Docs>
<param name="index">The zero-based index of the element to get or set.</param>
<summary>Gets or sets the element at the specified index.</summary>
<value>The element at the specified index.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property provides the ability to access a specific element in the collection by using the following syntax: `myCollection[index]`.
Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<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.CollectionBase.Count" />.</exception>
<block subset="none" type="overrides">
<para>When this property is set, the methods <see cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" />, <see cref="M:System.Collections.CollectionBase.OnSet(System.Int32,System.Object,System.Object)" />, and <see cref="M:System.Collections.CollectionBase.OnSetComplete(System.Int32,System.Object,System.Object)" /> are called.</para>
</block>
<altmember cref="P:System.Collections.CollectionBase.Count" />
</Docs>
</Member>
<Member MemberName="System.Collections.IList.Remove">
<MemberSignature Language="C#" Value="void IList.Remove (object value);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Collections.IList.Remove(object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.CollectionBase.System#Collections#IList#Remove(System.Object)" />
<MemberSignature Language="VB.NET" Value="Sub Remove (value As Object) Implements IList.Remove" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.Collections.IList.Remove(System::Object ^ value) = System::Collections::IList::Remove;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IList.Remove(System.Object)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">The <see cref="T:System.Object" /> to remove from the <see cref="T:System.Collections.CollectionBase" />.</param>
<summary>Removes the first occurrence of a specific object from the <see cref="T:System.Collections.CollectionBase" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the <xref:System.Collections.CollectionBase> does not contain the specified object, the <xref:System.Collections.CollectionBase> remains unchanged. No exception is thrown.
This method performs a linear search; therefore, this method is an O(`n`) operation, where `n` is <xref:System.Collections.CollectionBase.Count%2A>.
This method determines equality by calling <xref:System.Object.Equals%2A?displayProperty=nameWithType>.
In collections of contiguous elements, such as lists, the elements that follow the removed element move up to occupy the vacated spot. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.
## Examples
The following code example implements the <xref:System.Collections.CollectionBase> class and uses that implementation to create a collection of <xref:System.Int16> objects.
[!code-cpp[System.Collections.CollectionBase#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp#1)]
[!code-csharp[System.Collections.CollectionBase#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CS/collectionbase.cs#1)]
[!code-vb[System.Collections.CollectionBase#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.CollectionBase/VB/collectionbase.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The <paramref name="value" /> parameter was not found in the <see cref="T:System.Collections.CollectionBase" /> object.</exception>
<exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.CollectionBase" /> is read-only.
-or-
The <see cref="T:System.Collections.CollectionBase" /> has a fixed size.</exception>
<block subset="none" type="overrides">
<para>This method calls <see cref="M:System.Collections.CollectionBase.OnValidate(System.Object)" />, <see cref="M:System.Collections.CollectionBase.OnRemove(System.Int32,System.Object)" />, and <see cref="M:System.Collections.CollectionBase.OnRemoveComplete(System.Int32,System.Object)" />.</para>
</block>
<altmember cref="M:System.Collections.CollectionBase.RemoveAt(System.Int32)" />
<altmember cref="M:System.Collections.IList.Add(System.Object)" />
<altmember cref="M:System.Collections.IList.Insert(System.Int32,System.Object)" />
<related type="Article" href="~/docs/standard/globalization-localization/performing-culture-insensitive-string-operations.md">Performing Culture-Insensitive String Operations</related>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.