changing a boolean value outside a loop from inside a loop - C#