Top "Switch-expression" questions

In C# and Java switch expressions are an alternative to the switch statement that returns a value.

C# how to use enum with switch

I can't figure out how to use switches in combination with an enum. Could you please tell me what I'm …

c# enums switch-statement switch-expression
Combine return and switch

How can I combine return and switch case statements? I want something like return switch(a) { case 1:"lalala" case 2:"blalbla" …

c# switch-statement switch-expression
Multi-variable switch statement in C#

I would like use a switch statement which takes several variables and looks like this: switch (intVal1, strVal2, boolVal3) { case 1, "…

c# .net switch-statement logic switch-expression
C# 8 switch expression with multiple cases with same result

How can a switch expression be written to support multiple cases returning the same result? With C# prior to version 8, …

c# c#-8.0 switch-expression