1. Understanding C # Collections
System.Collections namespaces
System.CollectionsNamespaces contain interfaces and classes that define a collection of various objects such as lists, queues, bit arrays, hash tables, and dictionaries.class
|
class |
description |
|
ArrayList |
The IList interface is implemented using an array of size that dynamically increases on demand. |
|
BitArray |
Manages a compressed array of bit values that is represented as a Boolean value, where true indicates that the bit is open (1), andfalse indicates that the bit is closed (0). |
|
CaseInsensitiveComparer |
Compares two objects for equality, ignoring the case of a string when compared. |
|
CaseInsensitiveHashCodeProvider |
Provides a hash code for an object using a hashing algorithm that ignores the case of a string. |
|
CollectionBase |
Provides an abstract base class for a strongly typed collection. |
|
Comparer |
Compares two objects for equality, where string comparisons are case-sensitive. |
|
DictionaryBase |
Provides an abstract base class for a strongly typed collection of key/value pairs. |
|
Hashtable |
Represents a collection of key/value pairs that are organized according to the hash code of the key. |
|
Queue |
Represents an FIFO collection of objects. |
|
ReadOnlyCollectionBase |
Provides an abstract base class for strongly typed non-generic read-only collections. |
|
SortedList |
Represents a collection of key/value pairs that are sorted by keys and accessed by key and index. |
|
Stack |
Represents a simple last-in-first-out non-generic collection of objects. |
Interface
| |
interface |
description |
| |
ICollection |
defines the size, enumerator, and synchronization method for all non-generic collections. |
| |
IComparer |
exposes a method that compares two objects. |
| |
IDictionary |
represents a non-generic collection of key/value pairs. |
| |
IDictionaryEnumerator |
enumerates the elements of a non-generic dictionary. |
| |
IEnumerable |
exposes an enumerator that supports simple iterations on a non-generic collection. |
| |
IEnumerator |
supports simple iterations of non-generic collections. |
| |
IEqualityComparer |
defines methods to support equality comparisons of objects. |
| |
ihashcodeprovider |
Use a custom hash function to provide a hash code for the object. |
| |
IList |
represents a non-generic collection of objects that can be accessed individually by index. |
System.Collections.Generic namespaces
The System.Collections.Generic namespace contains interfaces and classes that define generic collections, which allow users to create strongly typed collections that provide better type security and performance than non-generic strongly typed collections.
class
|
class |
description |
|
Comparer |
Provides a base class for implementations of IComparer generic interfaces. |
|
Dictionary |
Represents a collection of keys and values. |
|
Dictionary.keycollection |
Represents a collection of keys in the Dictionary. This class cannot be inherited. |
|
Dictionary.valuecollection |
Represents a collection of values in Dictionary . This class cannot be inherited. |
|
Equalitycomparer |
Provides a base class for implementations of iequalitycomparer generic interfaces. |
|
KeyNotFoundException |
Specifies the exception that is thrown when the key used to access an element in the collection does not match any key in the collection. |
|
LinkedList |
Represents a doubly linked list. |
|
LinkedListNode |
Represents a node in a linkedlist. This class cannot be inherited. |
|
List |
Represents a strongly typed list of objects that can be accessed through an index. Provides methods for searching, sorting, and manipulating a list. |
|
Queue |
Represents an FIFO collection of objects. |
|
SortedDictionary |
Represents a collection of key/value pairs that are sorted by key. |
|
Sorteddictionary.keycollection |
Represents a collection of keys in the SortedDictionary. This class cannot be inherited. |
|
Sorteddictionary.valuecollection |
Represents a collection of values in sorteddictionary . This class cannot be inherited |
|
SortedList |
Represents a collection of key-value pairs that are sorted by key based on the associated IComparer implementation. |
|
Stack |
Represents a variable-size, last-in-first-out (LIFO) collection of instances of the same arbitrary type. |
Interface
|
Interface |
description |
|
ICollection |
Defines methods for manipulating generic collections. |
|
IComparer |
Defines a method that is implemented by a type that compares two objects. |
|
IDictionary |
Represents a generic collection of key/value pairs. |
|
IEnumerable |
Exposes an enumerator that supports simple iterations on a collection of the specified type. |
|
IEnumerator |
Supports simple iterations on a generic collection. |
|
IEqualityComparer |
Defines methods to support equality comparisons of objects. |
|
IList |
Represents a set of objects that can be accessed individually by index. |
C # Learning System.Collections.Generic and System.Collections Records