Beginner questions. prevent unhalted exception - C#