Let me explain what foreach actually does.
It iterates over a collection of elements inside an IEnumerable, in order, without skipping anything, even if the current element has the value null.
If you have an array with [5,2,24], the elements will be called in oder 5, 2, 24 and will stop after that.  
5
solved Asp.net foreach loop [closed]