-3

Many times I avoid to use arrays, because of must be careful to work its size, and I must certainly know data type of elements.

I notice, I usually use List, I am not sure this is necessary many times.

I would like to know how to design code when I work with collections.

Can someone help me to approach to collections? Thanks.

    * Arrays
    * List and List<T> 
    * Dictionary, Hashtable, Queue, Stack ...etc.
    * Sets 
Başar Kaya
  • 354
  • 6
  • 13

1 Answers1

1

Your question is more fundamental. First of all read about basic differences between that data structures. Then you would understand when is is better to use which of them.

Complete guide you could find here - https://msdn.microsoft.com/en-us/library/ms379570%28v=vs.80%29.aspx?f=255&MSPPError=-2147217396 You would become data strutures guru after reading this.

For example: If you need to call element by index - Array is your choice as it allows you to do it easily, but if you know that you would be continuously adding elements to data structure - then List is much better.

Good practice for you would be trying to implement yourself all data structures you point out using simple Array.

Alex
  • 790
  • 7
  • 20