Performance-wise both examples are compiled to the same IL, so there’s no difference.
The second is better, because it more clearly expresses your intent if u
is only used inside the loop.
Performance-wise both examples are compiled to the same IL, so there’s no difference.
The second is better, because it more clearly expresses your intent if u
is only used inside the loop.