Lets say I have two arrays with a bunch of instances of a class in them.
Element 40,000 of array1 points to the same exact instance that element 2,000 in array2 points to.
Is it then faster to do
Array2[2000]
rather than
Array1[40000]
in order to get that instance?
Meaning, does C# have a way of going directly to that element of the array? Or does having more elements in array before the desired index reduce the performance of getting to that index?
More specifically I think I am asking, internally, do C# arrays work like linked lists?
I’m not familiar with this term. I’ve searched google and got a few articles. But nothing to specific or in-depth. Could you further describe what this means?
Bear in mind that large arrays can suffer from LOH. I.E the garbage collection leaves the memory fragmented. Not sure if this is true of fixed array size or specifically List<> or Dictionary<,>.
Found out its on array’s where the array is over 85kb, .NET shove it on the large object heap (LOH). This is what can cause it