> For the complete documentation index, see [llms.txt](https://raviram.gitbook.io/c-programing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://raviram.gitbook.io/c-programing/collections/introduction.md).

# Introduction

## C# Collections

C# collection types are designed to store, manage and manipulate similar data more efficiently. Data manipulation includes adding, removing, finding, and inserting data in the collection. Collection types implement the following common functionality:&#x20;

* Adding and inserting items to a collection
* Removing items from a collection
* Finding, sorting, searching items
* Replacing items
* Copy and clone collections and items
* Capacity and Count properties to find the capacity of the collection and number of items in the collection

## Types of C# Collection Classes <a href="#types-of-collection-classes" id="types-of-collection-classes"></a>

In C# collections are divided into **3** classes. They are:

1. System.Collections.Generic
2. System.Collections
3. System.Collections.Concurrent

### System.Collections.Generic

The `System.Collections.Generic` namespace has following classes:

* **List**
* **HashSet**
* Stack
* Queue
* LinkedList
* SortedSet
* Dictionary
* SortedDictionary
* SortedList

### System.Collections.Generic

These classes are legacy. It is suggested now to use `System.Collections.Generic` classes. The `System.Collections` namespace has following classes:

* ArrayList
* Stack
* Queue
* Hashtable

## Collection Interface Hierarchy

<figure><img src="https://1308820094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F89QS43Vqawtxz4yckAZI%2Fuploads%2F96SRBojmzKTQIMV36c4K%2Fimage.png?alt=media&amp;token=7b0fb931-b8fb-4bef-8a02-f627adad7b8a" alt=""><figcaption></figcaption></figure>

## Detailed reading

{% embed url="<https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/collections>" %}
