﻿<?xml version="1.0" encoding="utf-8"?><Type Name="ICollection" FullName="System.Collections.ICollection" FullNameSP="System_Collections_ICollection" Maintainer="ecma"><TypeSignature Language="ILASM" Value=".class interface public abstract ICollection implements System.Collections.IEnumerable" /><TypeSignature Language="C#" Value="public interface ICollection : System.Collections.IEnumerable" /><TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract ICollection implements class System.Collections.IEnumerable" /><MemberOfLibrary>BCL</MemberOfLibrary><AssemblyInfo><AssemblyName>mscorlib</AssemblyName><AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><Interfaces><Interface><InterfaceName>System.Collections.IEnumerable</InterfaceName></Interface></Interfaces><Attributes><Attribute><AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName></Attribute></Attributes><Docs><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>The <see cref="T:System.Collections.ICollection" /> interface is the base interface for classes in the <see cref="N:System.Collections" /> namespace.</para><para>The <see cref="T:System.Collections.ICollection" /> interface extends <see cref="T:System.Collections.IEnumerable" />; <see cref="T:System.Collections.IDictionary" /> and <see cref="T:System.Collections.IList" /> are more specialized interfaces that extend <see cref="T:System.Collections.ICollection" />. An <see cref="T:System.Collections.IDictionary" /> implementation is a collection of key/value pairs, like the <see cref="T:System.Collections.Hashtable" /> class. An <see cref="T:System.Collections.IList" /> implementation is a collection of values and its members can be accessed by index, like the <see cref="T:System.Collections.ArrayList" /> class.</para><para>Some collections that limit access to their elements, such as the <see cref="T:System.Collections.Queue" /> class and the <see cref="T:System.Collections.Stack" /> class, directly implement the <see cref="T:System.Collections.ICollection" /> interface.</para><para>If neither the <see cref="T:System.Collections.IDictionary" /> interface nor the <see cref="T:System.Collections.IList" /> interface meet the requirements of the required collection, derive the new collection class from the <see cref="T:System.Collections.ICollection" /> interface instead for more flexibility.</para><para>For the generic version of this interface, see <see cref="T:System.Collections.Generic.ICollection`1" />.</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Defines size, enumerators, and synchronization methods for all nongeneric collections.</para></summary></Docs><Members><Member MemberName="CopyTo"><MemberSignature Language="ILASM" Value=".method public hidebysig virtual abstract void CopyTo(class System.Array array, int32 index)" /><MemberSignature Language="C#" Value="public void CopyTo (Array array, int index);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void CopyTo(class System.Array array, int32 index) cil managed" /><MemberType>Method</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.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><remarks><para><block subset="none" type="behaviors">As described above.</block></para><para><block subset="none" type="usage">Use this method to copy from a collection to a
   <see cref="T:System.Array" />.</block></para></remarks><exception cref="T:System.ArgumentNullException"><paramref name="array" /> is <see langword="null" />.</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index" /> &lt; 0.</exception><exception cref="T:System.ArgumentException"><para><paramref name="array" /> has more than one dimension.</para><para>-or-</para><para><paramref name="index" /> is greater than or equal to <paramref name="array" />.Length.</para><para>-or-</para><para> The sum of <paramref name="index" /> and the <see cref="P:System.Collections.ICollection.Count" /> of the current instance is greater than <paramref name="array" />.Length.</para></exception><exception cref="T:System.InvalidCastException">At least one element in the current instance is not assignment-compatible with the type of <paramref name="array" />.</exception><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>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.</para></summary><param name="array"><attribution license="cc4" from="Microsoft" modified="false" />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"><attribution license="cc4" from="Microsoft" modified="false" />The zero-based index in <paramref name="array" /> at which copying begins. </param></Docs><Excluded>0</Excluded></Member><Member MemberName="Count"><MemberSignature Language="ILASM" Value=".property int32 Count { public hidebysig virtual abstract specialname int32 get_Count() }" /><MemberSignature Language="C#" Value="public int Count { get; }" /><MemberSignature Language="ILAsm" Value=".property instance int32 Count" /><MemberType>Property</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Int32</ReturnType></ReturnValue><Parameters /><Docs><value><para>A <see cref="T:System.Int32" /> that indicates the number of elements contained in the current
   instance.</para></value><remarks><para>This property is read-only.</para><block subset="none" type="behaviors"><para>The <see cref="P:System.Collections.ICollection.Count" /> property
      is required to return the total number of elements contained in the current instance.</para></block></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Gets the number of elements contained in the <see cref="T:System.Collections.ICollection" />.</para></summary></Docs><Excluded>0</Excluded></Member><Member MemberName="IsSynchronized"><MemberSignature Language="ILASM" Value=".property bool IsSynchronized { public hidebysig virtual abstract specialname bool get_IsSynchronized() }" /><MemberSignature Language="C#" Value="public bool IsSynchronized { get; }" /><MemberSignature Language="ILAsm" Value=".property instance bool IsSynchronized" /><MemberType>Property</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Boolean</ReturnType></ReturnValue><Parameters /><Docs><value><para><see langword="true" /> if access to
   the current instance is synchronized (thread-safe); otherwise, <see langword="false" />.</para></value><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para><see cref="P:System.Collections.ICollection.SyncRoot" /> returns an object, which can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</para><para>Most collection classes in the <see cref="N:System.Collections" /> namespace also implement a Synchronized method, which provides a synchronized wrapper around the underlying collection.</para><para>Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.</para><para>The following code example shows how to lock the collection using the <see cref="P:System.Collections.ICollection.SyncRoot" /> property during the entire enumeration.</para><para>code reference: System.Collections.ICollection#1</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</para></summary></Docs><Excluded>0</Excluded></Member><Member MemberName="SyncRoot"><MemberSignature Language="ILASM" Value=".property object SyncRoot { public hidebysig virtual abstract specialname object get_SyncRoot() }" /><MemberSignature Language="C#" Value="public object SyncRoot { get; }" /><MemberSignature Language="ILAsm" Value=".property instance object SyncRoot" /><MemberType>Property</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Object</ReturnType></ReturnValue><Parameters /><Docs><value><para>A <see cref="T:System.Object" /> that can be
   used for thread-safe synchronized access to the current instance.</para></value><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>For collections whose underlying store is not publicly available, the expected implementation is to return the current instance. Note that the pointer to the current instance might not be sufficient for collections that wrap other collections; those should return the underlying collection's SyncRoot property.</para><para>Most collection classes in the <see cref="N:System.Collections" /> namespace also implement a Synchronized method, which provides a synchronized wrapper around the underlying collection. However, derived classes can provide their own synchronized version of the collection using the <see cref="P:System.Collections.ICollection.SyncRoot" /> property. The synchronizing code must perform operations on the <see cref="P:System.Collections.ICollection.SyncRoot" /> property of the collection, not directly on the collection. This ensures proper operation of collections that are derived from other objects. Specifically, it maintains proper synchronization with other threads that might be simultaneously modifying the collection instance.</para><para>In the absence of a Synchronized method on a collection, the expected usage for <see cref="P:System.Collections.ICollection.SyncRoot" /> looks as follows:</para><para>code reference: System.Collections.ICollection#2</para><para>Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.</para><para>The following code example shows how to lock the collection using the <see cref="P:System.Collections.ICollection.SyncRoot" /> property during the entire enumeration. </para><para>code reference: System.Collections.ICollection#1</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</para></summary></Docs><Excluded>0</Excluded></Member></Members><TypeExcluded>0</TypeExcluded></Type>