Collections Namespace
Namespace: System.Collections
Assembly: mscorlib.dll
Description: Contains interfaces and classes that define the behavior of collections of objects. This namespace includes non-generic collection types, as well as interfaces for generic collections.
Types in this Namespace
ICollection Interface
Namespace: System.Collections
Assembly: mscorlib.dll
Provides properties and methods for all collection types. This is the base interface for types that represent collections of objects.
public interface ICollection : IEnumerable
Members:
Count: Gets the number of elements contained in theICollection.IsSynchronized: Gets a value indicating whether access to theICollectionis synchronized (thread-safe).SyncRoot: Gets an object that can be used to synchronize access to theICollection.Add(object value): Adds an item to the end of theICollection.Clear(): Removes all items from theICollection.Contains(object value): Determines whether an element is in theICollection.CopyTo(Array array, int index): Copies the entireICollectionto a compatible one-dimensionalArray, starting at the specified index of the target array.GetEnumerator(): Returns an enumerator that iterates through theICollection.Remove(object value): Removes the first occurrence of a specific object from theICollection.
ICollection<T> Interface
Namespace: System.Collections.Generic
Assembly: mscorlib.dll
Represents a collection of objects of a specified type. This is the base interface for generic collection types.
public interface ICollection<T> : IEnumerable<T>, IEnumerable
Members:
Count: Gets the number of elements contained in theICollection<T>.Add(T item): Adds an item to the end of theICollection<T>.Clear(): Removes all items from theICollection<T>.Contains(T item): Determines whether an item is in theICollection<T>.CopyTo(T[] array, int arrayIndex): Copies the elements of theICollection<T>to anArray, starting at a specified array index.IsReadOnly: Gets a value indicating whether theICollection<T>is read-only.Remove(T item): Removes the first occurrence of a specific item from theICollection<T>.
IEnumerable Interface
Namespace: System.Collections
Assembly: mscorlib.dll
Exposes an enumerator, which supports a simple iteration over a non-generic collection.
public interface IEnumerable
Members:
GetEnumerator(): Returns an enumerator that iterates through a collection.
IEnumerator Interface
Namespace: System.Collections
Assembly: mscorlib.dll
Supports a simple iteration over a non-generic collection.
public interface IEnumerator
Members:
Current: Gets the current element in the collection.MoveNext(): Advances the enumerator to the next element of the collection.Reset(): Sets the enumerator to its initial position, which is before the first element in the collection.
IEnumerator<T> Interface
Namespace: System.Collections.Generic
Assembly: mscorlib.dll
Supports a generic iteration over a collection.
public interface IEnumerator<out T> : IDisposable, IEnumerator
Members:
Current: Gets the current element in the collection.MoveNext(): Advances the enumerator to the next element of the collection.Reset(): Sets the enumerator to its initial position. (Inherited fromIEnumerator)Dispose(): Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
IList Interface
Namespace: System.Collections
Assembly: mscorlib.dll
Represents a non-generic collection of objects that can be individually accessed by index. The list has an ordered collection of items. If the list is resizable, any number of elements can be added or removed from it.
public interface IList : ICollection, IEnumerable
Members:
IsFixedSize: Gets a value indicating whether theIListhas a fixed size.IsReadOnly: Gets a value indicating whether theIListis read-only.Item(int index): Gets or sets the element at the specified index.Add(object value): Inserts an item into theIListat the specified index.Clear(): Removes all items from theIList.Contains(object value): Determines whether an element is in theIList.IndexOf(object value): Determines the index of a specific item in theIList.Insert(int index, object value): Inserts an item into theIListat the specified index.Remove(object value): Removes the first occurrence of a specific object from theIList.RemoveAt(int index): Removes the element at the specified index of theIList.
IList<T> Interface
Namespace: System.Collections.Generic
Assembly: mscorlib.dll
Represents a strongly typed list of objects that can be individually accessed by index. The list has an ordered collection of items. If the list is resizable, any number of elements can be added or removed from it.
public interface IList<T> : ICollection<T>, IEnumerable<T>, IEnumerable
Members:
Item(int index): Gets or sets the element at the specified index.Add(T item): Adds an item to the end of theIList<T>.Clear(): Removes all items from theIList<T>.Contains(T item): Determines whether an item is in theIList<T>.IndexOf(T item): Searches for the specified object and returns the zero-based index of the first occurrence within the entireIList<T>.Insert(int index, T item): Inserts an item into theIList<T>at the specified index.Remove(T item): Removes the first occurrence of a specific item from theIList<T>.RemoveAt(int index): Removes the element at the specified index of theIList<T>.
IDictionary Interface
Namespace: System.Collections
Assembly: mscorlib.dll
Represents a collection of key/value pairs that are not ordered.
public interface IDictionary : ICollection, IEnumerable
Members:
IsFixedSize: Gets a value indicating whether theIDictionaryhas a fixed size.IsReadOnly: Gets a value indicating whether theIDictionaryis read-only.Keys: Gets anICollectioncontaining the keys in theIDictionary.Values: Gets anICollectioncontaining the values in theIDictionary.Item(object key): Gets or sets the element with the specified key.Add(object key, object value): Adds an element with the specified key and value to theIDictionary.Contains(object key): Determines whether theIDictionarycontains an element with the specified key.GetEnumerator(): Returns anIDictionaryEnumeratorthat iterates through theIDictionary.Remove(object key): Removes the element with the specified key from theIDictionary.
IDictionary<TKey, TValue> Interface
Namespace: System.Collections.Generic
Assembly: mscorlib.dll
Represents a collection of key/value pairs.
public interface IDictionary<TKey, TValue> : ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
Members:
Keys: Gets anICollectioncontaining the keys in theIDictionary<TKey, TValue>.Values: Gets anICollectioncontaining the values in theIDictionary<TKey, TValue>.Item(TKey key): Gets or sets the element with the specified key.Add(TKey key, TValue value): Adds an element with the specified key and value to theIDictionary<TKey, TValue>.ContainsKey(TKey key): Determines whether theIDictionary<TKey, TValue>contains an element with the specified key.Remove(TKey key): Removes the element with the specified key from theIDictionary<TKey, TValue>.TryGetValue(TKey key, out TValue value): Gets the value associated with the specified key.
KeyValuePair<TKey, TValue> Struct
Namespace: System.Collections.Generic
Assembly: mscorlib.dll
Represents a value of a specified type that is associated with a specified key. This structure is used by IDictionary<TKey, TValue>.
public struct KeyValuePair<TKey, TValue>
Members:
Key: Gets the key of the key/value pair.Value: Gets the value of the key/value pair.
IQueryable Interface
Namespace: System.Linq
Assembly: System.Core.dll
Provides information that allows an application to substitute for the query execution logic. This is the base interface for LINQ queries.
public interface IQueryable : IEnumerable
Members:
ElementType: Gets the type of elements in the sequence.Expression: Gets the expression tree that is associated with the data source.Provider: Gets the type of the LINQ provider.GetEnumerator(): Returns an enumerator that iterates through a collection.
IQueryable<T> Interface
Namespace: System.Linq
Assembly: System.Core.dll
Represents a queryable collection of elements of a specified type.
public interface IQueryable<out T> : IQueryable, IEnumerable<T>, IEnumerable
Members:
ElementType: Gets the type of elements in the sequence.Expression: Gets the expression tree that is associated with the data source.Provider: Gets the type of the LINQ provider.GetEnumerator(): Returns an enumerator that iterates through a collection.