System.Collections.Generic Namespace
This namespace contains interfaces and classes that define generic collections that can hold value types or object types. Generic collections provide a way to create collection classes that can store any type of data and that can be easily customized. This helps you to avoid type-related errors and improve performance.
Classes
Dictionary<TKey, TValue>
Class
Represents a collection of key/value pairs that are sorted by key. Each element in the dictionary is a structure that contains a value and a key.
public class Dictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IEnumerable
List<T>
Class
Represents a strongly typed list of objects that can be accessed by index. Provides methods for creating, searching, and manipulating lists.
public class List<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
Queue<T>
Class
Represents a collection of objects that are accessed in the first-in, first-out (FIFO) order. You can add elements to the end of the queue and remove them from the beginning.
public class Queue<T> : ICollection<T>, IEnumerable<T>, ICollection, IEnumerable
Stack<T>
Class
Represents a collection of objects that are accessed in the last-in, first-out (LIFO) order. You can add elements to the end of the stack and remove them from the same end.
public class Stack<T> : ICollection<T>, IEnumerable<T>, ICollection, IEnumerable
HashSet<T>
Class
Represents a collection of elements that uses hashing for efficient lookups. No duplicate elements are allowed.
public class HashSet<T> : ICollection<T>, IEnumerable<T>, ICollection, IEnumerable, ISet<T>
Interfaces
ICollection<T>
Interface
Represents a strongly typed collection of objects.
public interface ICollection<T> : IEnumerable<T>, IEnumerable
IEnumerable<T>
Interface
Exposes an enumerator, which iterates through the collection.
public interface IEnumerable<out T> : IEnumerable
IDictionary<TKey, TValue>
Interface
Represents a strongly typed collection of key/value pairs.
public interface IDictionary<TKey, TValue> : ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
IList<T>
Interface
Represents a strongly typed list of objects that can be accessed by index.
public interface IList<T> : ICollection<T>, IEnumerable<T>, IEnumerable