Home » C# Programming » Control Instructions

Which of the following statements is correct about the C#.NET code snippet given below? int i, j, id = 0; switch (id) { case i: Console.WriteLine("I am in Case i"); break; case j: Console.WriteLine("I am in Case j"); break; }

Correct Answer: The compiler will report case i and case j as errors since variables cannot be used in cases.

← Previous Question Next Question→

More Questions from Control Instructions

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion