Exit a loop early in C#