System.Collections.ObjectModel.Collection<T> Class

Provides the base class for a generic collection.

See Also: Collection<T> Members

Syntax

[System.Diagnostics.DebuggerDisplay("Count={Count}")]
[System.Diagnostics.DebuggerTypeProxy(typeof(System.Collections.Generic.CollectionDebuggerView`1))]
[System.Runtime.InteropServices.ComVisible(false)]
public class Collection<T> : ICollection<T>, IEnumerable<T>, IList<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, IList

Type Parameters

T
Documentation for this section has not yet been entered.

Remarks

The System.Collections.ObjectModel.Collection`1 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 System.Collections.ObjectModel.Collection`1 class itself.

The System.Collections.ObjectModel.Collection`1 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 System.Collections.ObjectModel.Collection`1 objects can be modified. However, a System.Collections.ObjectModel.Collection`1 object that is initialized with a read-only IList`1 object cannot be modified. See System.Collections.ObjectModel.ReadOnlyCollection`1 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.

System.Collections.ObjectModel.Collection`1 accepts null as a valid value for reference types and allows duplicate elements.

Requirements

Namespace: System.Collections.ObjectModel
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0