LANGUAGE
switch statement
Selects a matching section. A nonempty reachable section cannot fall through to the next section.
Formal Syntax & Structure
csharp syntaxcsharp
switch (value) { case pattern: ... break; default: ... break; }Working Example
Example Snippetcsharp
int n = 1; switch (n) { case 1: System.Console.WriteLine("One"); break; default: break; }