What are the advantages to using a
For, foreach. For and foreach differ slightly in performance. They are approximately the same speed. But the foreach loop uses more stack space for local variables.
The for-loop is faster than the foreach-loop if the array must only be accessed once per iteration.