Data structures in .NET

In table below official recommendations for choosing data structure for your needs:

GenericNon-GenericThread safePurpose
DictionaryHashtableConcurrentDictionarykey value pairs, lookup
ListArrayImmutableListaccess items by index
QueueConcurrentQueueFIFO queue
StackConcurrentStackLIFO queue
LinkedListaccess items sequentially
ObservableCollectionnotfications after modification
SortedListImmutableSortedSetauto sorted collection
HashSetImmutableHashSetdictionary of just keys (high performance set operations)

Further read:

https://learn.microsoft.com/en-us/dotnet/standard/collections/

One Reply to “Data structures in .NET”

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
3 + 7 =