System.Collections
The System.Collections namespace provides classes that implement collection data structures. These classes provide a way to store and manage collections of objects. The System.Collections namespace is a foundational part of the .NET Framework and provides basic collection functionality.
ArrayList
The ArrayList class provides a dynamically resizing array that can hold a collection of any object. It is a mutable collection that can be added to or removed from after creation.
Properties
- Count - The number of elements in the ArrayList.
- Capacity - The total number of elements the ArrayList can hold without resizing.
Methods
- Add - Adds an element to the end of the ArrayList.
- Remove - Removes the first occurrence of an element from the ArrayList.
Array
The Array class represents a contiguous block of memory used to store a fixed-size sequence of elements of the same type. Arrays are commonly used to store collections of related data.
Properties
- Length - The number of elements in the array.
Methods
- Copy - Copies a portion of one array to another.