Why is Array.Length
an int, and not a uint
. This bothers me (just a bit) because a length value can never be negative.
This also forced me to use an int for a length-property on my own class, because when you specify an int-value, this needs to be cast explicitly...
So the ultimate question is: is there any use for an unsigned int (uint
)? Even Microsoft seems not to use them.
for
loop:for (var i = arr.Length - 1; i >= 0; i--)
: IfLength
were unsigned,i--
would changei
from0
touint.Max
, and this loop would either repeat infinitely or try to access an illegal part of the array. – Slaver