Why does this work the way it does - C#