About 306,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. c# - How add "or" in switch statements? - Stack Overflow

    Apr 18, 2015 · 6 The example for switch statement shows that you can't stack non-empty case s, but should use goto s:

  3. Evaluate Expressions in Switch Statements in C#

    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 general, which includes switch statements.

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

    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.

  5. c# - Switch case: can I use a range instead of a one number - Stack ...

    In C# switch cases are basically dictionaries on what to do next. Since you can't look up a range in a dictionary, the best you can do is the case ... when statement Steve Gomez mentioned.

  6. 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

  7. How to make C# switch statement use IgnoreCase?

    Please have a look: Pattern Matching in C# 7.0 Case Blocks EDIT In light of @LewisM's answer, it's important to point out that the switch statement has some new, interesting behavior. That is that if …

  8. Add a additional condition to Case Statement in Switch

    Jan 10, 2013 · Is it possible to add a additional Condition to Switch Statement like below in C#

  9. c# - How to switch on System.Type? - Stack Overflow

    Mar 29, 2017 · In C# 7+, can I switch directly on a System.Type? When I try: switch (Type) { case typeof(int): break; } it tells me that typeof(int) needs to be a constant expression. Is

  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.