0

For the sake of curiosity. Does c# save the length of the array in a buffer value, or it's preferable to do it personally?

int[] numbers = {1,2,3,4,5,6}

a)

int x = numbers.length

for (i = 0; i < x, i++) {}

b)

for (i = 0; i < numbers.length; i++) {}

I don't remember seeing one piece of code using "a)" in c#, so either coders don't bother, either c# does the optimization.

I saw that for javascript.

Little_Dev
  • 107
  • 8
leGato
  • 9
  • 3

0 Answers0