Jump to content
  • Advertisement
Sign in to follow this  
Bombshell93

[help] C# - Collection Types

This topic is 2525 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'll get straight to the point,
How do the different C# Collection types work differently from each other?

I know queue has the last thing added last and list I think is visa versa.
But what about things like HashSet, ISet, Dictionary, Stack, SortedSet, LinkedList, etc. etc?
I've tried looking it up but not much says anything about their behavior even MSDN is fairly useless at documenting it (or it might be its odd layout)
Either way I'd like to know all I can for future reference, but atm I'm mainly looking for a collection type, that will allow me to give every instance an ID and access / create / destroy them efficiently using those ID's

Any and all help is appreciated,
Thanks in advanced,
Bombshell

Share this post


Link to post
Share on other sites
Advertisement
The C# collections are just implementations of the abstract computer science data structures. The best way to understand them is to do some research on the data structures themselves (non exhaustive):

  • Dynamic Array
  • Linked List
  • Queue
  • Stack
  • Double Ended Queue
  • Set
  • Hash table
  • Sorted Array
  • Tree

    Once you understand the data structures, the documentation for the specific C# implementations should be easier to understand.

    Some of these concepts overlap. For example, A dictionary could be implemented as an hash table, a sorted array, or some kind of tree, with different performance characteristics. A set can be implemented like a dictionary where the key is the value, but it can also be implemented with a linear search on a non-associated data structure, or a binary search on a sorted data structure.

Share this post


Link to post
Share on other sites

The C# collections are just implementations of the abstract computer science data structures. The best way to understand them is to do some research on the data structures themselves (non exhaustive):
  • Dynamic Array
  • Linked List
  • Queue
  • Stack
  • Double Ended Queue
  • Set
  • Hash table
  • Sorted Array
  • Tree
    Once you understand the data structures, the documentation for the specific C# implementations should be easier to understand.

    Some of these concepts overlap. For example, A dictionary could be implemented as an hash table, a sorted array, or some kind of tree, with different performance characteristics. A set can be implemented like a dictionary where the key is the value, but it can also be implemented with a linear search on a non-associated data structure, or a binary search on a sorted data structure.


You missed out the double linked list and red-black trees.

Red black trees are important for associative arrays as most implementations are based on a red-black tree behind the scenes(at least the STL one), which itself is a special form of tree.

Share this post


Link to post
Share on other sites

You missed out the double linked list and red-black trees.
[/quote]
I said that the list was not exhaustive. There are plenty more: Priority Queues, Tries, Bloom Filters, the list goes on.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!