Is there a performance difference between getting the count of an array (for example in c#) vs storing the count of an array in a variable.
This is assuming that the count isn't changing.
I'm presuming the answer will that storing it in a variable will cost more memory and accessing it directly e.g. array.length will be slightly slower (but the speed won't make any difference unless you are calling it lots and lots).
Does it vary significantly depending on the sort of collection e.g. List?
Is the performance between count/variable differ more in other languages e.g. javascript. (i.e. not the actual performance between languages, but the difference between techniques in the language).
thanks for your help.