C#: Arrays, List, and Collections [12 of 19]

Play C#: Arrays, List, and Collections [12 of 19]

The Discussion

  • User profile image
    Gouse Basha

    The best way to learn C#, The instructors Scott Hanselman, Kendra Havens are the best, easily understand the concepts of C#

  • User profile image

    About the bit about zero-indexed languages and one-indexed languages:

    I was told that the reason behind lists and arrays starting at index zero is because of binary storage used in computers. Because the index starts at 0, to access 8 elements of an array I will have to use indexes 0 to 7, which will take up 3-bits. If the index had started at 1, then I would have to use index 8 which would require 4-bits.

    I am not sure if this is the actual reason, but I think it makes sense.

  • User profile image

    If you learn classic C/C++ you get more into Pointers and their relations to array. The name of the Array is a pointer to the first element of that array in the memory. The next element is "size of type" further down in the memory.
    Example you have an array of int. The size of int is 64 bit (in x64), lets say the array<int> is stored at memory location 1000, then array[0] is at 1000. If you add to that 1000 the size if int (64) once you get to 1064, where array[1] is stored.

  • User profile image
    You are a great Team

Add Your 2 Cents