Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
2084 lines (1870 sloc) 135 KB
<Type Name="Collection&lt;T&gt;" FullName="System.Collections.ObjectModel.Collection&lt;T&gt;">
<TypeSignature Language="C#" Value="public class Collection&lt;T&gt; : System.Collections.Generic.ICollection&lt;T&gt;, System.Collections.Generic.IEnumerable&lt;T&gt;, System.Collections.Generic.IList&lt;T&gt;, System.Collections.Generic.IReadOnlyCollection&lt;T&gt;, System.Collections.Generic.IReadOnlyList&lt;T&gt;, System.Collections.IList" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit Collection`1&lt;T&gt; extends System.Object implements class System.Collections.Generic.ICollection`1&lt;!T&gt;, class System.Collections.Generic.IEnumerable`1&lt;!T&gt;, class System.Collections.Generic.IList`1&lt;!T&gt;, class System.Collections.Generic.IReadOnlyCollection`1&lt;!T&gt;, class System.Collections.Generic.IReadOnlyList`1&lt;!T&gt;, class System.Collections.ICollection, class System.Collections.IEnumerable, class System.Collections.IList" />
<TypeSignature Language="DocId" Value="T:System.Collections.ObjectModel.Collection`1" />
<TypeSignature Language="VB.NET" Value="Public Class Collection(Of T)&#xA;Implements ICollection(Of T), IEnumerable(Of T), IList, IList(Of T), IReadOnlyCollection(Of T), IReadOnlyList(Of T)" />
<TypeSignature Language="C++ CLI" Value="generic &lt;typename T&gt;&#xA;public ref class Collection : System::Collections::Generic::ICollection&lt;T&gt;, System::Collections::Generic::IEnumerable&lt;T&gt;, System::Collections::Generic::IList&lt;T&gt;, System::Collections::Generic::IReadOnlyCollection&lt;T&gt;, System::Collections::Generic::IReadOnlyList&lt;T&gt;, System::Collections::IList" />
<TypeSignature Language="F#" Value="type Collection&lt;'T&gt; = class&#xA; interface IList&lt;'T&gt;&#xA; interface IList&#xA; interface IReadOnlyList&lt;'T&gt;&#xA; interface ICollection&lt;'T&gt;&#xA; interface seq&lt;'T&gt;&#xA; interface IEnumerable&#xA; interface ICollection&#xA; interface IReadOnlyCollection&lt;'T&gt;" />
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<TypeParameters>
<TypeParameter Name="T" />
</TypeParameters>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.Collections.Generic.ICollection&lt;T&gt;</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Collections.Generic.IEnumerable&lt;T&gt;</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Collections.Generic.IList&lt;T&gt;</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Collections.Generic.IReadOnlyCollection&lt;T&gt;</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Collections.Generic.IReadOnlyList&lt;T&gt;</InterfaceName>
</Interface>
<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.Diagnostics.DebuggerDisplay("Count = {Count}")</AttributeName>
</Attribute>
<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.Diagnostics.DebuggerTypeProxy(typeof(System.Collections.Generic.Mscorlib_CollectionDebugView`1))</AttributeName>
</Attribute>
<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>
<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;netframework-4.8;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0">
<AttributeName>System.Serializable</AttributeName>
</Attribute>
</Attributes>
<Docs>
<typeparam name="T">The type of elements in the collection.</typeparam>
<summary>Provides the base class for a generic collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Collections.ObjectModel.Collection%601> class can be used immediately by creating an instance of one of its constructed types; all you have to do is specify the type of object to be contained in the collection. In addition, you can derive your own collection type from any constructed type, or derive a generic collection type from the <xref:System.Collections.ObjectModel.Collection%601> class itself.
The <xref:System.Collections.ObjectModel.Collection%601> class provides protected methods that can be used to customize its behavior when adding and removing items, clearing the collection, or setting the value of an existing item.
Most <xref:System.Collections.ObjectModel.Collection%601> objects can be modified. However, a <xref:System.Collections.ObjectModel.Collection%601> object that is initialized with a read-only <xref:System.Collections.Generic.IList%601> object cannot be modified. See <xref:System.Collections.ObjectModel.ReadOnlyCollection%601> for a read-only version of this class.
Elements in this collection can be accessed using an integer index. Indexes in this collection are zero-based.
<xref:System.Collections.ObjectModel.Collection%601> accepts `null` as a valid value for reference types and allows duplicate elements.
## Examples
This section contains two code examples. The first example demonstrates several properties and methods of the <xref:System.Collections.ObjectModel.Collection%601> class. The second example shows how to derive a collection class from a constructed type of <xref:System.Collections.ObjectModel.Collection%601>, and how to override the protected methods of <xref:System.Collections.ObjectModel.Collection%601> to provide custom behavior.
Example 1
The following code example demonstrates many of the properties and methods of <xref:System.Collections.ObjectModel.Collection%601>. The code example creates a collection of strings, uses the <xref:System.Collections.ObjectModel.Collection%601.Add%2A> method to add several strings, displays the <xref:System.Collections.ObjectModel.Collection%601.Count%2A>, and lists the strings. The example uses the <xref:System.Collections.ObjectModel.Collection%601.IndexOf%2A> method to find the index of a string and the <xref:System.Collections.ObjectModel.Collection%601.Contains%2A> method to determine whether a string is in the collection. The example inserts a string using the <xref:System.Collections.ObjectModel.Collection%601.Insert%2A> method and retrieves and sets strings using the default <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property (the indexer in C#). The example removes strings by string identity using the <xref:System.Collections.ObjectModel.Collection%601.Remove%2A> method and by index using the <xref:System.Collections.ObjectModel.Collection%601.RemoveAt%2A> method. Finally, the <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> method is used to clear all strings from the collection.
[!code-cpp[ObjectModel.Collection#1](~/samples/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp#1)]
[!code-csharp[ObjectModel.Collection#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.Collection/cs/source.cs#1)]
[!code-vb[ObjectModel.Collection#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.Collection/VB/source.vb#1)]
Example 2
The following code example shows how to derive a collection class from a constructed type of the <xref:System.Collections.ObjectModel.Collection%601> generic class, and how to override the protected <xref:System.Collections.ObjectModel.Collection%601.InsertItem%2A>, <xref:System.Collections.ObjectModel.Collection%601.RemoveItem%2A>, <xref:System.Collections.ObjectModel.Collection%601.ClearItems%2A>, and <xref:System.Collections.ObjectModel.Collection%601.SetItem%2A> methods to provide custom behavior for the <xref:System.Collections.ObjectModel.Collection%601.Add%2A>, <xref:System.Collections.ObjectModel.Collection%601.Insert%2A>, <xref:System.Collections.ObjectModel.Collection%601.Remove%2A>, and <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> methods, and for setting the <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property.
The custom behavior provided by this example is a `Changed` notification event that is raised at the end of each of the protected methods. The `Dinosaurs` class inherits `Collection<string>` (`Collection(Of String)` in Visual Basic) and defines the `Changed` event, which uses a `DinosaursChangedEventArgs` class for the event information, and an enumeration to identify the kind of change.
The code example calls several properties and methods of <xref:System.Collections.ObjectModel.Collection%601> to demonstrate the custom event.
[!code-csharp[ObjectModel.CollectionInherited#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.CollectionInherited/cs/source.cs#1)]
[!code-vb[ObjectModel.CollectionInherited#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.CollectionInherited/VB/source.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.
A <see cref="T:System.Collections.ObjectModel.Collection`1" /> can support multiple readers concurrently, as long as the collection is not modified. Even so, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.</threadsafe>
<block subset="none" type="overrides">
<para>This base class is provided to make it easier for implementers to create a custom collection. Implementers are encouraged to extend this base class instead of creating their own.</para>
</block>
<altmember cref="T:System.Collections.Generic.ICollection`1" />
<related type="Article" href="~/docs/standard/globalization-localization/performing-culture-insensitive-string-operations-in-collections.md">Performing Culture-Insensitive String Operations in Collections</related>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Collections.ObjectModel.Collection`1" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Collection ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; Collection();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Collections.ObjectModel.Collection`1" /> class that is empty.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This constructor is an O(1) operation.
## Examples
The following code example demonstrates many of the properties and methods of <xref:System.Collections.ObjectModel.Collection%601>. The code example creates a collection of strings with the <xref:System.Collections.ObjectModel.Collection%601.%23ctor> constructor, uses the <xref:System.Collections.ObjectModel.Collection%601.Add%2A> method to add several strings, displays the <xref:System.Collections.ObjectModel.Collection%601.Count%2A>, and lists the strings. The example uses the <xref:System.Collections.ObjectModel.Collection%601.IndexOf%2A> method to find the index of a string and the <xref:System.Collections.ObjectModel.Collection%601.Contains%2A> method to determine whether a string is in the collection. The example inserts a string using the <xref:System.Collections.ObjectModel.Collection%601.Insert%2A> method and retrieves and sets strings using the default <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property (the indexer in C#). The example removes strings by string identity using the <xref:System.Collections.ObjectModel.Collection%601.Remove%2A> method and by index using the <xref:System.Collections.ObjectModel.Collection%601.RemoveAt%2A> method. Finally, the <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> method is used to clear all strings from the collection.
[!code-cpp[ObjectModel.Collection#1](~/samples/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp#1)]
[!code-csharp[ObjectModel.Collection#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.Collection/cs/source.cs#1)]
[!code-vb[ObjectModel.Collection#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.Collection/VB/source.vb#1)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Collection (System.Collections.Generic.IList&lt;T&gt; list);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IList`1&lt;!T&gt; list) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.#ctor(System.Collections.Generic.IList{`0})" />
<MemberSignature Language="VB.NET" Value="Public Sub New (list As IList(Of T))" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; Collection(System::Collections::Generic::IList&lt;T&gt; ^ list);" />
<MemberSignature Language="F#" Value="new System.Collections.ObjectModel.Collection&lt;'T&gt; : System.Collections.Generic.IList&lt;'T&gt; -&gt; System.Collections.ObjectModel.Collection&lt;'T&gt;" Usage="new System.Collections.ObjectModel.Collection&lt;'T&gt; list" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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="list" Type="System.Collections.Generic.IList&lt;T&gt;" />
</Parameters>
<Docs>
<param name="list">The list that is wrapped by the new collection.</param>
<summary>Initializes a new instance of the <see cref="T:System.Collections.ObjectModel.Collection`1" /> class as a wrapper for the specified list.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The elements of the list are not copied. The list is wrapped by the collection, so that subsequent changes to the elements of the list are visible through the <xref:System.Collections.ObjectModel.Collection%601>.
This constructor is an O(1) operation.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="list" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Add">
<MemberSignature Language="C#" Value="public void Add (T item);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Add(!T item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.Add(`0)" />
<MemberSignature Language="VB.NET" Value="Public Sub Add (item As T)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void Add(T item);" />
<MemberSignature Language="F#" Value="abstract member Add : 'T -&gt; unit&#xA;override this.Add : 'T -&gt; unit" Usage="collection.Add item" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.Generic.ICollection`1.Add(`0)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="item" Type="T" />
</Parameters>
<Docs>
<param name="item">The object to be added to the end of the <see cref="T:System.Collections.ObjectModel.Collection`1" />. The value can be <see langword="null" /> for reference types.</param>
<summary>Adds an object to the end of the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Collections.ObjectModel.Collection%601> accepts `null` as a valid value for reference types and allows duplicate elements.
This method is an O(1) operation.
## Examples
The following code example demonstrates many of the properties and methods of <xref:System.Collections.ObjectModel.Collection%601>. The code example creates a collection of strings, uses the <xref:System.Collections.ObjectModel.Collection%601.Add%2A> method to add several strings, displays the <xref:System.Collections.ObjectModel.Collection%601.Count%2A>, and lists the strings. The example uses the <xref:System.Collections.ObjectModel.Collection%601.IndexOf%2A> method to find the index of a string and the <xref:System.Collections.ObjectModel.Collection%601.Contains%2A> method to determine whether a string is in the collection. The example inserts a string using the <xref:System.Collections.ObjectModel.Collection%601.Insert%2A> method and retrieves and sets strings using the default <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property (the indexer in C#). The example removes strings by string identity using the <xref:System.Collections.ObjectModel.Collection%601.Remove%2A> method and by index using the <xref:System.Collections.ObjectModel.Collection%601.RemoveAt%2A> method. Finally, the <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> method is used to clear all strings from the collection.
[!code-cpp[ObjectModel.Collection#1](~/samples/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp#1)]
[!code-csharp[ObjectModel.Collection#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.Collection/cs/source.cs#1)]
[!code-vb[ObjectModel.Collection#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.Collection/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Insert(System.Int32,`0)" />
<altmember cref="M:System.Collections.ObjectModel.Collection`1.InsertItem(System.Int32,`0)" />
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Remove(`0)" />
<altmember cref="M:System.Collections.ObjectModel.Collection`1.RemoveAt(System.Int32)" />
<altmember cref="M:System.Collections.ObjectModel.Collection`1.RemoveItem(System.Int32)" />
<altmember cref="P:System.Collections.ObjectModel.Collection`1.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.ObjectModel.Collection`1.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="collection.Clear " />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IList.Clear</InterfaceMember>
<InterfaceMember>M:System.Collections.Generic.ICollection`1.Clear</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Removes all elements from the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Collections.ObjectModel.Collection%601.Count%2A> is set to zero, and references to other objects from elements of the collection are also released.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
## Examples
The following code example demonstrates many of the properties and methods of <xref:System.Collections.ObjectModel.Collection%601>. The code example creates a collection of strings, uses the <xref:System.Collections.ObjectModel.Collection%601.Add%2A> method to add several strings, displays the <xref:System.Collections.ObjectModel.Collection%601.Count%2A>, and lists the strings. The example uses the <xref:System.Collections.ObjectModel.Collection%601.IndexOf%2A> method to find the index of a string and the <xref:System.Collections.ObjectModel.Collection%601.Contains%2A> method to determine whether a string is in the collection. The example inserts a string using the <xref:System.Collections.ObjectModel.Collection%601.Insert%2A> method and retrieves and sets strings using the default <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property (the indexer in C#). The example removes strings by string identity using the <xref:System.Collections.ObjectModel.Collection%601.Remove%2A> method and by index using the <xref:System.Collections.ObjectModel.Collection%601.RemoveAt%2A> method. Finally, the <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> method is used to clear all strings from the collection.
[!code-cpp[ObjectModel.Collection#1](~/samples/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp#1)]
[!code-csharp[ObjectModel.Collection#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.Collection/cs/source.cs#1)]
[!code-vb[ObjectModel.Collection#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.Collection/VB/source.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>Derived classes can override <see cref="M:System.Collections.ObjectModel.Collection`1.ClearItems" /> to change the behavior of this method.</para>
</block>
<altmember cref="P:System.Collections.ObjectModel.Collection`1.Count" />
</Docs>
</Member>
<Member MemberName="ClearItems">
<MemberSignature Language="C#" Value="protected virtual void ClearItems ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void ClearItems() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.ClearItems" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub ClearItems ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void ClearItems();" />
<MemberSignature Language="F#" Value="abstract member ClearItems : unit -&gt; unit&#xA;override this.ClearItems : unit -&gt; unit" Usage="collection.ClearItems " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Removes all elements from the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Collections.ObjectModel.Collection%601.Count%2A> is set to zero, and references to other objects from elements of the collection are also released.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
## Examples
The following code example shows how to derive a collection class from a constructed type of the <xref:System.Collections.ObjectModel.Collection%601> generic class, and how to override the protected <xref:System.Collections.ObjectModel.Collection%601.InsertItem%2A>, <xref:System.Collections.ObjectModel.Collection%601.RemoveItem%2A>, <xref:System.Collections.ObjectModel.Collection%601.ClearItems%2A>, and <xref:System.Collections.ObjectModel.Collection%601.SetItem%2A> methods to provide custom behavior for the <xref:System.Collections.ObjectModel.Collection%601.Add%2A>, <xref:System.Collections.ObjectModel.Collection%601.Insert%2A>, <xref:System.Collections.ObjectModel.Collection%601.Remove%2A>, and <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> methods, and for setting the <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property.
The custom behavior provided by this example is a `Changed` notification event that is raised at the end of each of the protected methods. The `Dinosaurs` class inherits `Collection<string>` (`Collection(Of String)` in Visual Basic) and defines the `Changed` event, which uses a `DinosaursChangedEventArgs` class for the event information, and an enumeration to identify the kind of change.
The code example calls several properties and methods of <xref:System.Collections.ObjectModel.Collection%601> to demonstrate the custom event.
[!code-csharp[ObjectModel.CollectionInherited#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.CollectionInherited/cs/source.cs#1)]
[!code-vb[ObjectModel.CollectionInherited#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.CollectionInherited/VB/source.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>Derived classes can override this method to change the behavior of the <see cref="M:System.Collections.ObjectModel.Collection`1.Clear" /> method.</para>
</block>
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Clear" />
</Docs>
</Member>
<Member MemberName="Contains">
<MemberSignature Language="C#" Value="public bool Contains (T item);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool Contains(!T item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.Contains(`0)" />
<MemberSignature Language="VB.NET" Value="Public Function Contains (item As T) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual bool Contains(T item);" />
<MemberSignature Language="F#" Value="abstract member Contains : 'T -&gt; bool&#xA;override this.Contains : 'T -&gt; bool" Usage="collection.Contains item" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.Generic.ICollection`1.Contains(`0)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="item" Type="T" />
</Parameters>
<Docs>
<param name="item">The object to locate in the <see cref="T:System.Collections.ObjectModel.Collection`1" />. The value can be <see langword="null" /> for reference types.</param>
<summary>Determines whether an element is in the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
<returns>
<see langword="true" /> if <paramref name="item" /> is found in the <see cref="T:System.Collections.ObjectModel.Collection`1" />; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the <xref:System.Collections.ObjectModel.Collection%601> object is created using the default constructor, this method determines equality using the default equality comparer <xref:System.Collections.Generic.EqualityComparer%601.Default%2A?displayProperty=nameWithType> for `T`, the type of values in the list. If type `T` does not implement the <xref:System.IEquatable%601> interface, the <xref:System.Object.Equals%2A> method is used.
If the Collection object is created by passing an <xref:System.Collections.Generic.IList%601> object to the constructor, the <xref:System.Collections.ObjectModel.Collection%601.Contains%2A> method will be determined by the <xref:System.Collections.Generic.IEqualityComparer%601> interface used by that <xref:System.Collections.Generic.IList%601> object.
This method performs a linear search; therefore, the average execution time is proportional to <xref:System.Collections.ObjectModel.Collection%601.Count%2A>. That is, this method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
]]></format>
</remarks>
<altmember cref="M:System.Collections.ObjectModel.Collection`1.IndexOf(`0)" />
<related type="Article" href="~/docs/standard/globalization-localization/performing-culture-insensitive-string-operations-in-collections.md">Performing Culture-Insensitive String Operations in Collections</related>
</Docs>
</Member>
<Member MemberName="CopyTo">
<MemberSignature Language="C#" Value="public void CopyTo (T[] array, int index);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void CopyTo(!T[] array, int32 index) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.CopyTo(`0[],System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Sub CopyTo (array As T(), index As Integer)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void CopyTo(cli::array &lt;T&gt; ^ array, int index);" />
<MemberSignature Language="F#" Value="abstract member CopyTo : 'T[] * int -&gt; unit&#xA;override this.CopyTo : 'T[] * int -&gt; unit" Usage="collection.CopyTo (array, index)" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.Generic.ICollection`1.CopyTo(`0[],System.Int32)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="array" Type="T[]" />
<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.ObjectModel.Collection`1" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
<param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
<summary>Copies the entire <see cref="T:System.Collections.ObjectModel.Collection`1" /> to a compatible one-dimensional <see cref="T:System.Array" />, starting at the specified index of the target array.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method uses <xref:System.Array.Copy%2A?displayProperty=nameWithType> to copy the elements.
The elements are copied to the <xref:System.Array> in the same order in which the enumerator iterates through the <xref:System.Collections.ObjectModel.Collection%601>.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.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">The number of elements in the source <see cref="T:System.Collections.ObjectModel.Collection`1" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
</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.ObjectModel.Collection`1.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.ObjectModel.Collection&lt;'T&gt;.Count" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.Generic.ICollection`1.Count</InterfaceMember>
<InterfaceMember>P:System.Collections.Generic.IReadOnlyCollection`1.Count</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the number of elements actually contained in the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
<value>The number of elements actually contained in the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Retrieving the value of this property is an O(1) operation.
## Examples
The following code example demonstrates many of the properties and methods of <xref:System.Collections.ObjectModel.Collection%601>. The code example creates a collection of strings, uses the <xref:System.Collections.ObjectModel.Collection%601.Add%2A> method to add several strings, displays the <xref:System.Collections.ObjectModel.Collection%601.Count%2A>, and lists the strings. The example uses the <xref:System.Collections.ObjectModel.Collection%601.IndexOf%2A> method to find the index of a string and the <xref:System.Collections.ObjectModel.Collection%601.Contains%2A> method to determine whether a string is in the collection. The example inserts a string using the <xref:System.Collections.ObjectModel.Collection%601.Insert%2A> method and retrieves and sets strings using the default <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property (the indexer in C#). The example removes strings by string identity using the <xref:System.Collections.ObjectModel.Collection%601.Remove%2A> method and by index using the <xref:System.Collections.ObjectModel.Collection%601.RemoveAt%2A> method. Finally, the <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> method is used to clear all strings from the collection.
[!code-cpp[ObjectModel.Collection#1](~/samples/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp#1)]
[!code-csharp[ObjectModel.Collection#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.Collection/cs/source.cs#1)]
[!code-vb[ObjectModel.Collection#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.Collection/VB/source.vb#1)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="GetEnumerator">
<MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerator&lt;T&gt; GetEnumerator ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Collections.Generic.IEnumerator`1&lt;!T&gt; GetEnumerator() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.GetEnumerator" />
<MemberSignature Language="VB.NET" Value="Public Function GetEnumerator () As IEnumerator(Of T)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual System::Collections::Generic::IEnumerator&lt;T&gt; ^ GetEnumerator();" />
<MemberSignature Language="F#" Value="abstract member GetEnumerator : unit -&gt; System.Collections.Generic.IEnumerator&lt;'T&gt;&#xA;override this.GetEnumerator : unit -&gt; System.Collections.Generic.IEnumerator&lt;'T&gt;" Usage="collection.GetEnumerator " />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.Generic.IEnumerable`1.GetEnumerator</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<ReturnValue>
<ReturnType>System.Collections.Generic.IEnumerator&lt;T&gt;</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
<returns>An <see cref="T:System.Collections.Generic.IEnumerator`1" /> for the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The `foreach` statement of the C# language (`for each` in C++, `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. At this position, <xref:System.Collections.Generic.IEnumerator%601.Current%2A> is undefined. 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.Generic.IEnumerator%601.Current%2A>.
<xref:System.Collections.Generic.IEnumerator%601.Current%2A> returns the same object until <xref:System.Collections.IEnumerator.MoveNext%2A> is called. <xref:System.Collections.IEnumerator.MoveNext%2A> sets <xref:System.Collections.Generic.IEnumerator%601.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`, <xref:System.Collections.Generic.IEnumerator%601.Current%2A> is undefined. You cannot set <xref:System.Collections.Generic.IEnumerator%601.Current%2A> to the first element of the collection again; you must create a new enumerator instance instead.
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 its behavior is undefined.
The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
Default implementations of collections in <xref:System.Collections.Generic?displayProperty=nameWithType> are not synchronized.
This method is an O(1) operation.
]]></format>
</remarks>
<altmember cref="T:System.Collections.Generic.IEnumerator`1" />
</Docs>
</Member>
<Member MemberName="IndexOf">
<MemberSignature Language="C#" Value="public int IndexOf (T item);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance int32 IndexOf(!T item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.IndexOf(`0)" />
<MemberSignature Language="VB.NET" Value="Public Function IndexOf (item As T) As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual int IndexOf(T item);" />
<MemberSignature Language="F#" Value="abstract member IndexOf : 'T -&gt; int&#xA;override this.IndexOf : 'T -&gt; int" Usage="collection.IndexOf item" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.Generic.IList`1.IndexOf(`0)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="item" Type="T" />
</Parameters>
<Docs>
<param name="item">The object to locate in the <see cref="T:System.Collections.Generic.List`1" />. The value can be <see langword="null" /> for reference types.</param>
<summary>Searches for the specified object and returns the zero-based index of the first occurrence within the entire <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
<returns>The zero-based index of the first occurrence of <paramref name="item" /> within the entire <see cref="T:System.Collections.ObjectModel.Collection`1" />, if found; otherwise, -1.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Collections.ObjectModel.Collection%601> is searched forward starting at the first element and ending at the last element.
This method determines equality using the default equality comparer <xref:System.Collections.Generic.EqualityComparer%601.Default%2A?displayProperty=nameWithType> for `T`, the type of values in the list.
This method performs a linear search; therefore, the average execution time is proportional to <xref:System.Collections.ObjectModel.Collection%601.Count%2A>. That is, this method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
## Examples
The following code example demonstrates many of the properties and methods of <xref:System.Collections.ObjectModel.Collection%601>. The code example creates a collection of strings, uses the <xref:System.Collections.ObjectModel.Collection%601.Add%2A> method to add several strings, displays the <xref:System.Collections.ObjectModel.Collection%601.Count%2A>, and lists the strings. The example uses the <xref:System.Collections.ObjectModel.Collection%601.IndexOf%2A> method to find the index of a string and the <xref:System.Collections.ObjectModel.Collection%601.Contains%2A> method to determine whether a string is in the collection. The example inserts a string using the <xref:System.Collections.ObjectModel.Collection%601.Insert%2A> method and retrieves and sets strings using the default <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property (the indexer in C#). The example removes strings by string identity using the <xref:System.Collections.ObjectModel.Collection%601.Remove%2A> method and by index using the <xref:System.Collections.ObjectModel.Collection%601.RemoveAt%2A> method. Finally, the <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> method is used to clear all strings from the collection.
[!code-cpp[ObjectModel.Collection#1](~/samples/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp#1)]
[!code-csharp[ObjectModel.Collection#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.Collection/cs/source.cs#1)]
[!code-vb[ObjectModel.Collection#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.Collection/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Contains(`0)" />
<related type="Article" href="~/docs/standard/globalization-localization/performing-culture-insensitive-string-operations-in-collections.md">Performing Culture-Insensitive String Operations in Collections</related>
</Docs>
</Member>
<Member MemberName="Insert">
<MemberSignature Language="C#" Value="public void Insert (int index, T item);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Insert(int32 index, !T item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.Insert(System.Int32,`0)" />
<MemberSignature Language="VB.NET" Value="Public Sub Insert (index As Integer, item As T)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void Insert(int index, T item);" />
<MemberSignature Language="F#" Value="abstract member Insert : int * 'T -&gt; unit&#xA;override this.Insert : int * 'T -&gt; unit" Usage="collection.Insert (index, item)" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.Generic.IList`1.Insert(System.Int32,`0)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="item" Type="T" />
</Parameters>
<Docs>
<param name="index">The zero-based index at which <paramref name="item" /> should be inserted.</param>
<param name="item">The object to insert. The value can be <see langword="null" /> for reference types.</param>
<summary>Inserts an element into the <see cref="T:System.Collections.ObjectModel.Collection`1" /> at the specified index.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Collections.ObjectModel.Collection%601> accepts `null` as a valid value for reference types and allows duplicate elements.
If `index` is equal to <xref:System.Collections.ObjectModel.Collection%601.Count%2A>, `item` is added to the end of <xref:System.Collections.ObjectModel.Collection%601>.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
]]></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.ObjectModel.Collection`1.Count" />.</exception>
<block subset="none" type="overrides">
<para>Derived classes can override <see cref="M:System.Collections.ObjectModel.Collection`1.InsertItem(System.Int32,`0)" /> to change the behavior of this method.</para>
</block>
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Add(`0)" />
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Remove(`0)" />
</Docs>
</Member>
<Member MemberName="InsertItem">
<MemberSignature Language="C#" Value="protected virtual void InsertItem (int index, T item);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void InsertItem(int32 index, !T item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.InsertItem(System.Int32,`0)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub InsertItem (index As Integer, item As T)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void InsertItem(int index, T item);" />
<MemberSignature Language="F#" Value="abstract member InsertItem : int * 'T -&gt; unit&#xA;override this.InsertItem : int * 'T -&gt; unit" Usage="collection.InsertItem (index, item)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="item" Type="T" />
</Parameters>
<Docs>
<param name="index">The zero-based index at which <paramref name="item" /> should be inserted.</param>
<param name="item">The object to insert. The value can be <see langword="null" /> for reference types.</param>
<summary>Inserts an element into the <see cref="T:System.Collections.ObjectModel.Collection`1" /> at the specified index.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Collections.ObjectModel.Collection%601.InsertItem%2A> is meant to be overridden in a derived class. For a public method to insert an item in the <xref:System.Collections.ObjectModel.Collection%601>, see <xref:System.Collections.ObjectModel.Collection%601.Insert%2A>.
<xref:System.Collections.ObjectModel.Collection%601> accepts `null` as a valid value for reference types and allows duplicate elements.
If `index` is equal to <xref:System.Collections.ObjectModel.Collection%601.Count%2A>, `item` is added to the end of <xref:System.Collections.ObjectModel.Collection%601>.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
## Examples
The following code example shows how to derive a collection class from a constructed type of the <xref:System.Collections.ObjectModel.Collection%601> generic class, and how to override the protected <xref:System.Collections.ObjectModel.Collection%601.InsertItem%2A>, <xref:System.Collections.ObjectModel.Collection%601.RemoveItem%2A>, <xref:System.Collections.ObjectModel.Collection%601.ClearItems%2A>, and <xref:System.Collections.ObjectModel.Collection%601.SetItem%2A> methods to provide custom behavior for the <xref:System.Collections.ObjectModel.Collection%601.Add%2A>, <xref:System.Collections.ObjectModel.Collection%601.Insert%2A>, <xref:System.Collections.ObjectModel.Collection%601.Remove%2A>, and <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> methods, and for setting the <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property.
The custom behavior provided by this example is a `Changed` notification event that is raised at the end of each of the protected methods. The `Dinosaurs` class inherits `Collection<string>` (`Collection(Of String)` in Visual Basic) and defines the `Changed` event, which uses a `DinosaursChangedEventArgs` class for the event information, and an enumeration to identify the kind of change.
The code example calls several properties and methods of <xref:System.Collections.ObjectModel.Collection%601> to demonstrate the custom event.
[!code-csharp[ObjectModel.CollectionInherited#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.CollectionInherited/cs/source.cs#1)]
[!code-vb[ObjectModel.CollectionInherited#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.CollectionInherited/VB/source.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.ObjectModel.Collection`1.Count" />.</exception>
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Insert(System.Int32,`0)" />
</Docs>
</Member>
<Member MemberName="Item">
<MemberSignature Language="C#" Value="public T this[int index] { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance !T Item(int32)" />
<MemberSignature Language="DocId" Value="P:System.Collections.ObjectModel.Collection`1.Item(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Default Public Property Item(index As Integer) As T" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property T default[int] { T get(int index); void set(int index, T value); };" />
<MemberSignature Language="F#" Value="member this.Item(int) : 'T with get, set" Usage="System.Collections.ObjectModel.Collection&lt;'T&gt;.Item" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.Generic.IList`1.Item(System.Int32)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>T</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
<xref:System.Collections.ObjectModel.Collection%601> accepts `null` as a valid value for reference types and allows duplicate elements.
This property provides the ability to access a specific element in the collection by using the following syntax: `myCollection[index]`.
The C# language uses the keyword to define the indexers instead of implementing the <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property. Visual Basic implements <xref:System.Collections.ObjectModel.Collection%601.Item%2A> as a default property, which provides the same indexing functionality.
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 demonstrates many of the properties and methods of <xref:System.Collections.ObjectModel.Collection%601>. The code example creates a collection of strings, uses the <xref:System.Collections.ObjectModel.Collection%601.Add%2A> method to add several strings, displays the <xref:System.Collections.ObjectModel.Collection%601.Count%2A>, and lists the strings. The example uses the <xref:System.Collections.ObjectModel.Collection%601.IndexOf%2A> method to find the index of a string and the <xref:System.Collections.ObjectModel.Collection%601.Contains%2A> method to determine whether a string is in the collection. The example inserts a string using the <xref:System.Collections.ObjectModel.Collection%601.Insert%2A> method and retrieves and sets strings using the default <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property (the indexer in C#). The example removes strings by string identity using the <xref:System.Collections.ObjectModel.Collection%601.Remove%2A> method and by index using the <xref:System.Collections.ObjectModel.Collection%601.RemoveAt%2A> method. Finally, the <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> method is used to clear all strings from the collection.
[!code-cpp[ObjectModel.Collection#1](~/samples/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp#1)]
[!code-csharp[ObjectModel.Collection#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.Collection/cs/source.cs#1)]
[!code-vb[ObjectModel.Collection#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.Collection/VB/source.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.ObjectModel.Collection`1.Count" />.</exception>
<block subset="none" type="overrides">
<para>Derived classes can override <see cref="M:System.Collections.ObjectModel.Collection`1.SetItem(System.Int32,`0)" /> to change the behavior of setting this property.</para>
</block>
<altmember cref="P:System.Collections.ObjectModel.Collection`1.Count" />
</Docs>
</Member>
<Member MemberName="Items">
<MemberSignature Language="C#" Value="protected System.Collections.Generic.IList&lt;T&gt; Items { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IList`1&lt;!T&gt; Items" />
<MemberSignature Language="DocId" Value="P:System.Collections.ObjectModel.Collection`1.Items" />
<MemberSignature Language="VB.NET" Value="Protected ReadOnly Property Items As IList(Of T)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; property System::Collections::Generic::IList&lt;T&gt; ^ Items { System::Collections::Generic::IList&lt;T&gt; ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Items : System.Collections.Generic.IList&lt;'T&gt;" Usage="System.Collections.ObjectModel.Collection&lt;'T&gt;.Items" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<ReturnValue>
<ReturnType>System.Collections.Generic.IList&lt;T&gt;</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a <see cref="T:System.Collections.Generic.IList`1" /> wrapper around the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
<value>A <see cref="T:System.Collections.Generic.IList`1" /> wrapper around the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The wrapper provides the functionality of the <xref:System.Collections.Generic.IList%601> class and exposes all the elements of the <xref:System.Collections.ObjectModel.Collection%601>.
Retrieving the value of this property is an O(1) operation.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Remove">
<MemberSignature Language="C#" Value="public bool Remove (T item);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool Remove(!T item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.Remove(`0)" />
<MemberSignature Language="VB.NET" Value="Public Function Remove (item As T) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual bool Remove(T item);" />
<MemberSignature Language="F#" Value="abstract member Remove : 'T -&gt; bool&#xA;override this.Remove : 'T -&gt; bool" Usage="collection.Remove item" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.Generic.ICollection`1.Remove(`0)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="item" Type="T" />
</Parameters>
<Docs>
<param name="item">The object to remove from the <see cref="T:System.Collections.ObjectModel.Collection`1" />. The value can be <see langword="null" /> for reference types.</param>
<summary>Removes the first occurrence of a specific object from the <see cref="T:System.Collections.ObjectModel.Collection`1" />.</summary>
<returns>
<see langword="true" /> if <paramref name="item" /> is successfully removed; otherwise, <see langword="false" />. This method also returns <see langword="false" /> if <paramref name="item" /> was not found in the original <see cref="T:System.Collections.ObjectModel.Collection`1" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method determines equality using the default equality comparer <xref:System.Collections.Generic.EqualityComparer%601.Default%2A?displayProperty=nameWithType> for `T`, the type of values in the list.
This method performs a linear search; therefore, the average execution time is proportional to <xref:System.Collections.ObjectModel.Collection%601.Count%2A>. That is, this method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
## Examples
The following code example demonstrates many of the properties and methods of <xref:System.Collections.ObjectModel.Collection%601>. The code example creates a collection of strings, uses the <xref:System.Collections.ObjectModel.Collection%601.Add%2A> method to add several strings, displays the <xref:System.Collections.ObjectModel.Collection%601.Count%2A>, and lists the strings. The example uses the <xref:System.Collections.ObjectModel.Collection%601.IndexOf%2A> method to find the index of a string and the <xref:System.Collections.ObjectModel.Collection%601.Contains%2A> method to determine whether a string is in the collection. The example inserts a string using the <xref:System.Collections.ObjectModel.Collection%601.Insert%2A> method and retrieves and sets strings using the default <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property (the indexer in C#). The example removes strings by string identity using the <xref:System.Collections.ObjectModel.Collection%601.Remove%2A> method and by index using the <xref:System.Collections.ObjectModel.Collection%601.RemoveAt%2A> method. Finally, the <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> method is used to clear all strings from the collection.
[!code-cpp[ObjectModel.Collection#1](~/samples/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp#1)]
[!code-csharp[ObjectModel.Collection#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.Collection/cs/source.cs#1)]
[!code-vb[ObjectModel.Collection#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.Collection/VB/source.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>Derived classes can override <see cref="M:System.Collections.ObjectModel.Collection`1.RemoveItem(System.Int32)" /> to change the behavior of this method.</para>
</block>
<altmember cref="M:System.Collections.ObjectModel.Collection`1.RemoveAt(System.Int32)" />
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Add(`0)" />
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Insert(System.Int32,`0)" />
<related type="Article" href="~/docs/standard/globalization-localization/performing-culture-insensitive-string-operations-in-collections.md">Performing Culture-Insensitive String Operations in Collections</related>
</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.ObjectModel.Collection`1.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="collection.RemoveAt index" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.Generic.IList`1.RemoveAt(System.Int32)</InterfaceMember>
<InterfaceMember>M:System.Collections.IList.RemoveAt(System.Int32)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<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.ObjectModel.Collection`1" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
## Examples
The following code example demonstrates many of the properties and methods of <xref:System.Collections.ObjectModel.Collection%601>. The code example creates a collection of strings, uses the <xref:System.Collections.ObjectModel.Collection%601.Add%2A> method to add several strings, displays the <xref:System.Collections.ObjectModel.Collection%601.Count%2A>, and lists the strings. The example uses the <xref:System.Collections.ObjectModel.Collection%601.IndexOf%2A> method to find the index of a string and the <xref:System.Collections.ObjectModel.Collection%601.Contains%2A> method to determine whether a string is in the collection. The example inserts a string using the <xref:System.Collections.ObjectModel.Collection%601.Insert%2A> method and retrieves and sets strings using the default <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property (the indexer in C#). The example removes strings by string identity using the <xref:System.Collections.ObjectModel.Collection%601.Remove%2A> method and by index using the <xref:System.Collections.ObjectModel.Collection%601.RemoveAt%2A> method. Finally, the <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> method is used to clear all strings from the collection.
[!code-cpp[ObjectModel.Collection#1](~/samples/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp#1)]
[!code-csharp[ObjectModel.Collection#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.Collection/cs/source.cs#1)]
[!code-vb[ObjectModel.Collection#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.Collection/VB/source.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.ObjectModel.Collection`1.Count" />.</exception>
<block subset="none" type="overrides">
<para>Derived classes can override <see cref="M:System.Collections.ObjectModel.Collection`1.RemoveItem(System.Int32)" /> to change the behavior of this method.</para>
</block>
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Remove(`0)" />
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Add(`0)" />
<altmember cref="M:System.Collections.ObjectModel.Collection`1.Insert(System.Int32,`0)" />
</Docs>
</Member>
<Member MemberName="RemoveItem">
<MemberSignature Language="C#" Value="protected virtual void RemoveItem (int index);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void RemoveItem(int32 index) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.RemoveItem(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub RemoveItem (index As Integer)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void RemoveItem(int index);" />
<MemberSignature Language="F#" Value="abstract member RemoveItem : int -&gt; unit&#xA;override this.RemoveItem : int -&gt; unit" Usage="collection.RemoveItem index" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<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.ObjectModel.Collection`1" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
## Examples
The following code example shows how to derive a collection class from a constructed type of the <xref:System.Collections.ObjectModel.Collection%601> generic class, and how to override the protected <xref:System.Collections.ObjectModel.Collection%601.InsertItem%2A>, <xref:System.Collections.ObjectModel.Collection%601.RemoveItem%2A>, <xref:System.Collections.ObjectModel.Collection%601.ClearItems%2A>, and <xref:System.Collections.ObjectModel.Collection%601.SetItem%2A> methods to provide custom behavior for the <xref:System.Collections.ObjectModel.Collection%601.Add%2A>, <xref:System.Collections.ObjectModel.Collection%601.Insert%2A>, <xref:System.Collections.ObjectModel.Collection%601.Remove%2A>, and <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> methods, and for setting the <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property.
The custom behavior provided by this example is a `Changed` notification event that is raised at the end of each of the protected methods. The `Dinosaurs` class inherits `Collection<string>` (`Collection(Of String)` in Visual Basic) and defines the `Changed` event, which uses a `DinosaursChangedEventArgs` class for the event information, and an enumeration to identify the kind of change.
The code example calls several properties and methods of <xref:System.Collections.ObjectModel.Collection%601> to demonstrate the custom event.
[!code-csharp[ObjectModel.CollectionInherited#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.CollectionInherited/cs/source.cs#1)]
[!code-vb[ObjectModel.CollectionInherited#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.CollectionInherited/VB/source.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.ObjectModel.Collection`1.Count" />.</exception>
<altmember cref="M:System.Collections.ObjectModel.Collection`1.RemoveAt(System.Int32)" />
</Docs>
</Member>
<Member MemberName="SetItem">
<MemberSignature Language="C#" Value="protected virtual void SetItem (int index, T item);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void SetItem(int32 index, !T item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.SetItem(System.Int32,`0)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub SetItem (index As Integer, item As T)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void SetItem(int index, T item);" />
<MemberSignature Language="F#" Value="abstract member SetItem : int * 'T -&gt; unit&#xA;override this.SetItem : int * 'T -&gt; unit" Usage="collection.SetItem (index, item)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="item" Type="T" />
</Parameters>
<Docs>
<param name="index">The zero-based index of the element to replace.</param>
<param name="item">The new value for the element at the specified index. The value can be <see langword="null" /> for reference types.</param>
<summary>Replaces the element at the specified index.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Collections.ObjectModel.Collection%601> accepts `null` as a valid value for reference types and allows duplicate elements.
This method is an O(1) operation.
## Examples
The following code example shows how to derive a collection class from a constructed type of the <xref:System.Collections.ObjectModel.Collection%601> generic class, and how to override the protected <xref:System.Collections.ObjectModel.Collection%601.InsertItem%2A>, <xref:System.Collections.ObjectModel.Collection%601.RemoveItem%2A>, <xref:System.Collections.ObjectModel.Collection%601.ClearItems%2A>, and <xref:System.Collections.ObjectModel.Collection%601.SetItem%2A> methods to provide custom behavior for the <xref:System.Collections.ObjectModel.Collection%601.Add%2A>, <xref:System.Collections.ObjectModel.Collection%601.Insert%2A>, <xref:System.Collections.ObjectModel.Collection%601.Remove%2A>, and <xref:System.Collections.ObjectModel.Collection%601.Clear%2A> methods, and for setting the <xref:System.Collections.ObjectModel.Collection%601.Item%2A> property.
The custom behavior provided by this example is a `Changed` notification event that is raised at the end of each of the protected methods. The `Dinosaurs` class inherits `Collection<string>` (`Collection(Of String)` in Visual Basic) and defines the `Changed` event, which uses a `DinosaursChangedEventArgs` class for the event information, and an enumeration to identify the kind of change.
The code example calls several properties and methods of <xref:System.Collections.ObjectModel.Collection%601> to demonstrate the custom event.
[!code-csharp[ObjectModel.CollectionInherited#1](~/samples/snippets/csharp/VS_Snippets_CLR/ObjectModel.CollectionInherited/cs/source.cs#1)]
[!code-vb[ObjectModel.CollectionInherited#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/ObjectModel.CollectionInherited/VB/source.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.ObjectModel.Collection`1.Count" />.</exception>
<altmember cref="P:System.Collections.ObjectModel.Collection`1.Item(System.Int32)" />
<altmember cref="P:System.Collections.ObjectModel.Collection`1.Items" />
</Docs>
</Member>
<Member MemberName="System.Collections.Generic.ICollection&lt;T&gt;.IsReadOnly">
<MemberSignature Language="C#" Value="bool System.Collections.Generic.ICollection&lt;T&gt;.IsReadOnly { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool System.Collections.Generic.ICollection&lt;T&gt;.IsReadOnly" />
<MemberSignature Language="DocId" Value="P:System.Collections.ObjectModel.Collection`1.System#Collections#Generic#ICollection&lt;T&gt;#IsReadOnly" />
<MemberSignature Language="VB.NET" Value=" ReadOnly Property IsReadOnly As Boolean Implements ICollection(Of T).IsReadOnly" />
<MemberSignature Language="C++ CLI" Value="property bool System::Collections::Generic::ICollection&lt;T&gt;::IsReadOnly { bool get(); };" />
<MemberSignature Language="F#" Usage="System.Collections.Generic.ICollection&lt;T&gt;.IsReadOnly" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.Generic.ICollection`1.IsReadOnly</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the <see cref="T:System.Collections.Generic.ICollection`1" /> is read-only.</summary>
<value>
<see langword="true" /> if the <see cref="T:System.Collections.Generic.ICollection`1" /> is read-only; otherwise, <see langword="false" />. In the default implementation of <see cref="T:System.Collections.ObjectModel.Collection`1" />, this property always returns <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.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.ObjectModel.Collection`1.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.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<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.ICollection" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
<param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
<summary>Copies the elements of the <see cref="T:System.Collections.ICollection" /> to an <see cref="T:System.Array" />, starting at a particular <see cref="T:System.Array" /> index.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!NOTE]
> If the type of the source <xref:System.Collections.ICollection> cannot be cast automatically to the type of the destination `array`, the non-generic implementations of <xref:System.Collections.ICollection.CopyTo%2A?displayProperty=nameWithType> throw <xref:System.InvalidCastException>, whereas the generic implementations throw <xref:System.ArgumentException>.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.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-
<paramref name="array" /> does not have zero-based indexing.
-or-
The number of elements in the source <see cref="T:System.Collections.ICollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.
-or-
The type of the source <see cref="T:System.Collections.ICollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
</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.ObjectModel.Collection`1.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.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
<value>
<see langword="true" /> if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, <see langword="false" />. In the default implementation of <see cref="T:System.Collections.ObjectModel.Collection`1" />, this property always returns <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Default implementations of collections in <xref:System.Collections.Generic?displayProperty=nameWithType> are not synchronized.
Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
<xref:System.Collections.ICollection.SyncRoot%2A> returns an object that can be used to synchronize access to the <xref:System.Collections.ICollection>. Synchronization is effective only if all threads lock this object before accessing the collection.
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.ObjectModel.Collection`1.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.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<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.ICollection" />.</summary>
<value>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. In the default implementation of <see cref="T:System.Collections.ObjectModel.Collection`1" />, this property always returns the current instance.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Default implementations of collections in <xref:System.Collections.Generic?displayProperty=nameWithType> are not synchronized.
Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
<xref:System.Collections.ICollection.SyncRoot%2A> returns an object that can be used to synchronize access to the <xref:System.Collections.ICollection>. Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the <xref:System.Collections.ICollection.SyncRoot%2A> property for C#, C++, and Visual Basic.
```csharp
ICollection ic = ...;
lock (ic.SyncRoot) {
// Access the collection.
}
```
```vb
Dim ic As ICollection = ...
SyncLock ic.SyncRoot
' Access the collection.
End SyncLock
```
```cpp#
ICollection^ ic = ...;
try {
Monitor::Enter(ic->SyncRoot);
// Access the collection.
}
finally {
Monitor::Exit(ic->SyncRoot);
}
```
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.IEnumerable.GetEnumerator">
<MemberSignature Language="C#" Value="System.Collections.IEnumerator IEnumerable.GetEnumerator ();" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance class System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Collections.ObjectModel.Collection`1.System#Collections#IEnumerable#GetEnumerator" />
<MemberSignature Language="VB.NET" Value="Function GetEnumerator () As IEnumerator Implements IEnumerable.GetEnumerator" />
<MemberSignature Language="C++ CLI" Value=" virtual System::Collections::IEnumerator ^ System.Collections.IEnumerable.GetEnumerator() = System::Collections::IEnumerable::GetEnumerator;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IEnumerable.GetEnumerator</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<ReturnValue>
<ReturnType>System.Collections.IEnumerator</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Returns an enumerator that iterates through a collection.</summary>
<returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the collection.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The `foreach` statement of the C# language (`for each` in C++, `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, <xref:System.Collections.IEnumerator.Current%2A> is undefined. 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`, <xref:System.Collections.IEnumerator.Current%2A> is undefined. 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 its behavior is undefined.
The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
Default implementations of collections in <xref:System.Collections.Generic?displayProperty=nameWithType> are not synchronized.
This method is an O(1) operation.
]]></format>
</remarks>
<altmember cref="T:System.Collections.IEnumerator" />
</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.ObjectModel.Collection`1.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.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<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 add to the <see cref="T:System.Collections.IList" />.</param>
<summary>Adds an item to the <see cref="T:System.Collections.IList" />.</summary>
<returns>The position into which the new element was inserted.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is an O(1) operation.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
</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.ObjectModel.Collection`1.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.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<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.IList" />.</param>
<summary>Determines whether the <see cref="T:System.Collections.IList" /> contains a specific value.</summary>
<returns>
<see langword="true" /> if the <see cref="T:System.Object" /> is found in the <see cref="T:System.Collections.IList" />; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method determines equality by first determining whether `value` is of type `T` (or null) and then calling <xref:System.Collections.ObjectModel.Collection%601.Contains%2A>.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
</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.ObjectModel.Collection`1.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.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<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.IList" />.</param>
<summary>Determines the index of a specific item in the <see cref="T:System.Collections.IList" />.</summary>
<returns>The index of <paramref name="value" /> if found in the list; otherwise, -1.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method determines equality using the default comparer <xref:System.Collections.Generic.Comparer%601.Default%2A?displayProperty=nameWithType>. <xref:System.Collections.Generic.Comparer%601.Default%2A?displayProperty=nameWithType> checks whether type `T` implements <xref:System.IComparable%601?displayProperty=nameWithType> and uses that implementation, if available. If not, <xref:System.Collections.Generic.Comparer%601.Default%2A?displayProperty=nameWithType> checks whether type `T` implements <xref:System.IComparable?displayProperty=nameWithType>. If type `T` does not implement either interface, this method uses <xref:System.Object.Equals%2A?displayProperty=nameWithType>.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
</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.ObjectModel.Collection`1.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.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<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 into the <see cref="T:System.Collections.IList" />.</param>
<summary>Inserts an item into the <see cref="T:System.Collections.IList" /> at the specified index.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If `index` equals the number of items in the <xref:System.Collections.IList>, then `value` is appended to the end.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="index" /> is not a valid index in the <see cref="T:System.Collections.IList" />.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
</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.ObjectModel.Collection`1.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.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the <see cref="T:System.Collections.IList" /> has a fixed size.</summary>
<value>
<see langword="true" /> if the <see cref="T:System.Collections.IList" /> has a fixed size; otherwise, <see langword="false" />. In the default implementation of <see cref="T:System.Collections.ObjectModel.Collection`1" />, this property always returns <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.ObjectModel.Collection`1.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.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the <see cref="T:System.Collections.IList" /> is read-only.</summary>
<value>
<see langword="true" /> if the <see cref="T:System.Collections.IList" /> is read-only; otherwise, <see langword="false" />. In the default implementation of <see cref="T:System.Collections.ObjectModel.Collection`1" />, this property always returns <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.ObjectModel.Collection`1.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.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<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]`.
The C# language uses the [this](~/docs/csharp/language-reference/keywords/this.md) keyword to define the indexers instead of implementing the <xref:System.Collections.ObjectModel.Collection%601.System%23Collections%23IList%23Item%2A> property. Visual Basic implements <xref:System.Collections.ObjectModel.Collection%601.System%23Collections%23IList%23Item%2A> as a default property, which provides the same indexing functionality.
Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="index" /> is not a valid index in the <see cref="T:System.Collections.IList" />.</exception>
<exception cref="T:System.ArgumentException">The property is set and <paramref name="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
</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.ObjectModel.Collection`1.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.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.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>
<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.IList" />.</param>
<summary>Removes the first occurrence of a specific object from the <see cref="T:System.Collections.IList" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method determines equality using the default comparer <xref:System.Collections.Generic.Comparer%601.Default%2A?displayProperty=nameWithType>. <xref:System.Collections.Generic.Comparer%601.Default%2A?displayProperty=nameWithType> checks whether type `T` implements <xref:System.IComparable%601?displayProperty=nameWithType> and uses that implementation, if available. If not, <xref:System.Collections.Generic.Comparer%601.Default%2A?displayProperty=nameWithType> checks whether type `T` implements <xref:System.IComparable?displayProperty=nameWithType>. If type `T` does not implement either interface, this method uses <xref:System.Object.Equals%2A?displayProperty=nameWithType>.
This method is an O(`n`) operation, where `n` is <xref:System.Collections.ObjectModel.Collection%601.Count%2A>.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="value" /> is of a type that is not assignable to the <see cref="T:System.Collections.IList" />.</exception>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.