About 10,300,000 results
Open links in new tab
  1. c# - Multiple cases in switch statement - Stack Overflow

    In C# 7 (available by default in Visual Studio 2017/.NET Framework 4.6.2), range-based switching is now possible with the switch statement and would help with the OP's problem.

  2. Evaluate Expressions in Switch Statements in C# - Stack Overflow

    28 In a twist of C# fate, this has come all the way back around. If you upgrade to C# 9.0, your original switch statement will now compile! C#9.0 has added Relational patterns to pattern matching in …

  3. Is is possible to have multiple lines in a switch statement of C# 8 ...

    Oct 26, 2024 · C# switch expression aims to return value by pattern match. For your scenario, you should use the traditional switch statement.

  4. .net - Multi-variable switch statement in C# - Stack Overflow

    1 Per the C# language specification, the switch statement expression must resolve to one of sbyte, byte, sbyte, byte, short, ushort, int, uint, long, ulong, char, string, or an enum-type. This means you cannot …

  5. c# - How add "or" in switch statements? - Stack Overflow

    Apr 18, 2015 · How add "or" in switch statements? Asked 16 years, 7 months ago Modified 3 years, 6 months ago Viewed 198k times

  6. C# switch clause on boolean variable - Stack Overflow

    Dec 20, 2018 · Using switch statement for bool is not good coding practice so you should avoid it. Just use if/else for bool and switch inside or call another function to handle the switch statement.

  7. C# 8 switch expression with multiple cases with same result

    Jun 20, 2019 · How can a switch expression be written to support multiple cases returning the same result? With C# prior to version 8, a switch may be written like so: var switchValue = 3; var resultText …

  8. Inline switch / case statement in C# - Stack Overflow

    Inline switch / case statement in C# Asked 15 years, 4 months ago Modified 2 years, 10 months ago Viewed 99k times

  9. C# switch statement limitations - why? - Stack Overflow

    Sep 5, 2008 · When writing a switch statement, there appears to be two limitations on what you can switch on in case statements. For example (and yes, I know, if you're doing this sort of thing it …

  10. Combine return and switch in C# - Stack Overflow

    This Stack Overflow page discusses combining return and switch statements in C# programming, offering insights and examples for developers.