C# Switch Statements
Use the switch statement to select one of many code blocks to be executed.
switch(expression) { case a: // code block break; case b: // code block break; default: // code block break; }
This is how it works:
switch
expression is evaluated oncecase
break
and default
keywords will be described later in this chapterBeing a reference to the method, a delegate in C# works like a function pointer in C and C++. As compared to a function pointer, a delegate in C# is objected-oriented, secured, and type-safe.
Delegate => action, as lambda
Resources