ICollection Interface
Defines size, enumerators and synchronization methods for all collections.
For a list of all members of this type, see ICollection Members.
System.Collections.IEnumerable
System.Collections.ICollection
[Visual Basic] Public Interface ICollection Inherits IEnumerable [C#] public interface ICollection : IEnumerable [C++] public __gc __interface ICollection : public IEnumerable [JScript] public interface ICollection implements IEnumerable
Classes that Implement ICollection
| Class | Description |
|---|---|
| Array | Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime. |
| ArrayList | Implements the IList interface using an array whose size is dynamically increased as required. |
| AttributeCollection | Represents a collection of attributes. |
| BaseChannelObjectWithProperties | Provides a base implementation of a channel object that wants to provide a dictionary interface to its properties. |
| BaseCollection | Provides the base functionality for creating data-related collections in the System.Windows.Forms namespace. |
| BindingContext | Manages the collection of BindingManagerBase objects for any object that inherits from the Control class. |
| BitArray | Manages a compact array of bit values, which are represented as Booleans, where true indicates that the bit is on (1) and false indicates the bit is off (0). |
| CaptureCollection | Represents a sequence of capture substrings. CaptureCollection returns the set of captures done by a single capturing group. |
| CheckedListBox.CheckedIndexCollection | Encapsulates the collection of indexes of checked items (including items in an indeterminate state) in a CheckedListBox. |
| CheckedListBox.CheckedItemCollection | Encapsulates the collection of checked items (including items in an indeterminate state) in a CheckedListBox control. |
| CodeNamespaceImportCollection | Represents a collection of CodeNamespaceImport objects. |
| CollectionBase | Provides the abstract (MustInherit in Visual Basic) base class for a strongly typed collection. |
| ComboBox.ObjectCollection | Represents the collection of items in a ComboBox. |
| Control.ControlCollection | Represents a collection of Control objects |
| ControlCollection | Provides a collection container that enables ASP.NET server controls to maintain a list of their child controls. |
| CookieCollection | Provides a collection container for instances of the Cookie class. |
| DataBindingCollection | Provides a collection of DataBinding objects for an ASP.NET server control. This class cannot be inherited. |
| DataColumnMappingCollection | Contains a collection of DataColumnMapping objects. |
| DataGridColumnCollection | A collection of DataGridColumn derived column objects that represent the columns in a DataGrid control. This class cannot be inherited. |
| DataGridItemCollection | Represents a collection of DataGridItem objects in a DataGrid control. |
| DataKeyCollection | Represents a collection that contains the key field of each record in a data source. This class cannot be inherited. |
| DataListItemCollection | Represents the collection of DataListItem objects in the DataList control. This class cannot be inherited. |
| DataTableMappingCollection | A collection of DataTableMapping objects. This class cannot be inherited. |
| DataView | Represents a databindable, customized view of a DataTable for sorting, filtering, searching, editing, and navigation. |
| DataViewManager | Contains a default DataViewSettingCollection for each DataTable in a DataSet. |
| DataViewSettingCollection | Contains a read-only collection of DataViewSetting objects for each DataTable in a DataSet. |
| DesignerCollection | Represents a collection of designers. |
| DictionaryBase | Provides the abstract (MustInherit in Visual Basic) base class for a strongly typed collection of key-and-value pairs. |
| EventDescriptorCollection | Represents a collection of EventDescriptor objects. |
| EventLogEntryCollection | Defines size and enumerators for a collection of EventLogEntry instances. |
| Evidence | Defines the set of information that constitutes input to security policy decisions. This class cannot be inherited. |
| GridItemCollection | Contains a collection of GridItem objects. |
| GroupCollection | Represents a collection of captured groups. GroupCollection returns the set of captured groups in a single match. |
| Hashtable | Represents a collection of key-and-value pairs that are organized based on the hash code of the key. |
| HtmlTableCellCollection | A collection of HtmlTableCell objects that represent the cells in a single row of an HtmlTable control. This class cannot be inherited. |
| HtmlTableRowCollection | A collection of HtmlTableRow objects that represent the rows of an HtmlTable control. This class cannot be inherited. |
| HttpSessionState | Provides access to session-state values as well as session-level settings and lifetime management methods. |
| HttpStaticObjectsCollection | Provides a static objects collection for the StaticObjects property. |
| HybridDictionary | Implements IDictionary by using a ListDictionary while the collection is small, and then switching to a Hashtable when the collection gets large. |
| ImageList.ImageCollection | Encapsulates the collection of Image objects in an ImageList. |
| InternalDataCollectionBase | Provides the base functionality for creating collections. |
| LinkLabel.LinkCollection | Represents the collection of links within a LinkLabel control. |
| ListBox.ObjectCollection | Represents the collection of items in a ListBox. |
| ListBox.SelectedIndexCollection | Represents the collection containing the indexes to the selected items in a ListBox. |
| ListBox.SelectedObjectCollection | Represents the collection of selected items in the ListBox. |
| ListDictionary | Implements IDictionary using a singly linked list. Recommended for collections that typically contain 10 items or less. |
| ListItemCollection | A collection of ListItem objects in a list control. This class cannot be inherited. |
| ListView.CheckedIndexCollection | Represents the collection containing the indexes to the checked items in a list view control. |
| ListView.CheckedListViewItemCollection | Represents the collection of checked items in a list view control. |
| ListView.ColumnHeaderCollection | Represents the collection of column headers in a ListView control. |
| ListView.ListViewItemCollection | Represents the collection of items in a ListView control. |
| ListView.SelectedIndexCollection | Represents the collection containing the indexes to the selected items in a list view control. |
| ListView.SelectedListViewItemCollection | Represents the collection of selected items in a list view control. |
| ListViewItem.ListViewSubItemCollection | Represents a collection of ListViewItem.ListViewSubItem objects stored in a ListViewItem. |
| ManagementObjectCollection | Represents different collections of management objects retrieved through WMI. The objects in this collection are of ManagementBaseObject-derived types, including ManagementObject and ManagementClass.
The collection can be the result of a WMI query executed through a ManagementObjectSearcher object, or an enumeration of management objects of a specified type retrieved through a ManagementClass representing that type. In addition, this can be a collection of management objects related in a specified way to a specific management object - in this case the collection would be retrieved through a method such as GetRelated. The collection can be walked using the ManagementObjectCollection.ManagementObjectEnumerator and objects in it can be inspected or manipulated for various management tasks. |
| MatchCollection | Represents the set of successful matches found by iteratively applying a regular expression pattern to the input string. |
| Menu.MenuItemCollection | Represents a collection of MenuItem objects. |
| MethodDataCollection | Represents the set of methods available in the collection. |
| NameObjectCollectionBase | Provides the abstract (MustInherit in Visual Basic) base class for a collection of associated String keys and Object values that can be accessed either with the key or with the index. |
| NameObjectCollectionBase.KeysCollection | Represents a collection of the String keys of a collection. |
| OdbcErrorCollection | Collects all errors generated by the OdbcDataAdapter. This class cannot be inherited. |
| OdbcParameterCollection | Represents a collection of parameters relevant to an OdbcCommand as well as their respective mappings to columns in a DataSet. This class cannot be inherited. |
| OleDbErrorCollection | Collects all errors generated by the .NET Framework Data Provider for OLE DB. This class cannot be inherited. |
| OleDbParameterCollection | Represents a collection of parameters relevant to an OleDbCommand as well as their respective mappings to columns in a DataSet. |
| OracleParameterCollection | Represents a collection of parameters relevant to an OracleCommand as well as their respective mappings to columns in a DataSet. This class cannot be inherited. |
| PagedDataSource | Encapsulates the properties of the DataGrid control that allow it to perform paging. This class cannot be inherited. |
| PermissionSet | Represents a collection that can contain many different types of permissions. |
| PrinterSettings.PaperSizeCollection | Contains a collection of PaperSize objects. |
| PrinterSettings.PaperSourceCollection | Contains a collection of PaperSource objects. |
| PrinterSettings.PrinterResolutionCollection | Contains a collection of PrinterResolution objects. |
| PropertyCollection | Contains the properties of a DirectoryEntry. |
| PropertyDataCollection | Represents the set of properties of a WMI object. |
| PropertyDescriptorCollection | Represents a collection of PropertyDescriptor objects. |
| PropertyGrid.PropertyTabCollection | Contains a collection of PropertyTab objects. |
| QualifierDataCollection | Represents a collection of QualifierData objects. |
| Queue | Represents a first-in, first-out collection of objects. |
| ReadOnlyCollectionBase | Provides the abstract (MustInherit in Visual Basic) base class for a strongly typed read-only collection. |
| RepeaterItemCollection | Represents a collection of RepeaterItem objects in the Repeater control. This class cannot be inherited. |
| SchemaNameCollection | Contains a list of the schema names that the SchemaFilter property of a DirectoryEntries object can use. |
| SearchResultCollection | Contains the SearchResult instances that the Active Directory hierarchy returned during a DirectorySearcher query. |
| SelectedDatesCollection | Encapsulates a collection of System.DateTime objects that represent the selected dates in a Calendar control. This class cannot be inherited. |
| SignedInfo | Contains information about the canonicalization algorithm and signature algorithm used for the XML signature. |
| SortedList | Represents a collection of key-and-value pairs that are sorted by the keys and are accessible by key and by index. |
| SqlCeErrorCollection | Collects all errors generated by the .NET Compact Framework Data Provider for SQL Server CE. This class cannot be inherited. |
| SqlCeParameterCollection | Collects all parameters relevant to a SqlCeCommand as well as their respective mappings to DataSet columns. |
| SqlErrorCollection | Collects all errors generated by the .NET Framework Data Provider for SQL Server. This class cannot be inherited. |
| SqlParameterCollection | Represents a collection of parameters relevant to a SqlCommand as well as their respective mappings to columns in a DataSet. This class cannot be inherited. |
| Stack | Represents a simple last-in-first-out collection of objects. |
| StateBag | Manages the view state of ASP.NET server controls, including pages. This class cannot be inherited. |
| StatusBar.StatusBarPanelCollection | Represents the collection of panels in a StatusBar control. |
| StringCollection | Represents a collection of strings. |
| TabControl.TabPageCollection | Contains a collection of TabPage objects. |
| TableCellCollection | Encapsulates a collection of TableHeaderCell and TableCell objects that make up a row in a Table control. This class cannot be inherited. |
| TableRowCollection | Encapsulates a collection of TableRow objects that represent a single row in a Table control. This class cannot be inherited. |
| TempFileCollection | Represents a collection of temporary files. |
| ToolBar.ToolBarButtonCollection | Encapsulates a collection of ToolBarButton controls for use by the ToolBar class. |
| TraceListenerCollection | Provides a thread-safe list of TraceListener objects. |
| TreeNodeCollection | Represents a collection of TreeNode objects. |
| TypeConverter.StandardValuesCollection | Represents a collection of values. |
| ValidatorCollection | Exposes an array of IValidator references. This class cannot be inherited. |
| XmlAttributeCollection | Represents a collection of attributes that can be accessed by name or index. |
| XmlSchemaCollection | Contains a cache of XML Schema definition language (XSD) and XML-Data Reduced (XDR) schemas. This class cannot be inherited. |
Remarks
The ICollection interface is the base interface for classes in the System.Collections namespace.
IDictionary and IList are more specialized interfaces that are based on the ICollection interface. An IDictionary implementation is a collection of key-and-value pairs, like the Hashtable class. An IList implementation is a collection of values that can be sorted and whose members can be accessed by index, like the ArrayList class.
Some collections that limit access to their elements, like the Queue class and the Stack class, directly implement the ICollection interface.
If neither the IDictionary interface nor the IList interface meet the requirements of the required collection, derive the new collection class from the ICollection interface instead for more flexibility.
Requirements
Namespace: System.Collections
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
Assembly: Mscorlib (in Mscorlib.dll)
See Also
ICollection Members | System.Collections Namespace | IDictionary | IList