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

    Is there a way to fall through multiple case statements without stating case value: repeatedly? I know this works: case 1: case 2: case 3: // Do some stuff. break; case 4: case 5: case 6: // Do …

  2. C# Switch - W3Schools

    Use the switch statement to select one of many code blocks to be executed. This is how it works: The example below uses the weekday number to calculate the weekday name: …

    Missing:

    • Index

    Must include:

  3. C# Switch With Examples - C# Corner

    The code examples in this article demonstrate various use cases of switch case statements in C# and .NET Core. C# switch statement pairs with one or more case blocks and a default block. …

    Missing:

    • Index

    Must include:

  4. Multiple Case Switch Statement in C# - Delft Stack

    Feb 16, 2024 · This tutorial will introduce methods to create a multiple-case switch statement in C#. A switch statement is a selection structure that is used to select one particular case from a …

    Missing:

    • Index

    Must include:

  5. Mastering Multiple Conditions with C# Switch Case Statement

    Aug 7, 2024 · Let's dive into how to effectively handle multiple conditions using the switch case in C#. The basic syntax of the switch statement in C# looks like this: case value1: // code block …

    Missing:

    • Index

    Must include:

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

    switch ((intVal1, strVal2, boolVal3)) { case (1, "hello", false): break; case (2, "world", false): break; case (2, "hello", false): break; } If you want to switch and return a value there's a switch …

  7. C# Case Statement : Switching Between Multiple Cases

    Each switch section has one case label such as case 1 and two statements. Example 1: Simple Case Statement int value = 1; switch (value) { case 1: Console.WriteLine("Case 1"); break; …

  8. Mastering Multiple Cases in C# Switch Statements

    Aug 7, 2024 · To handle multiple cases in a C# switch statement, you can simply stack the cases one after the other without any additional syntax. This allows you to execute the same block of …

  9. C# Case Statement - Learnsic

    May 27, 2024 · In C#, you can group multiple cases together by listing them one after another, separated by commas. Here's an example: int day = 4; string dayName; switch (day) case 1: …

  10. Add a additional condition to Case Statement in Switch

    Jan 10, 2013 · You have to use the if condition inside your case , you can't use && in case statement, use like below: switch(MyEnum) { case 1: case 2: case 3: //Additional Condtion …

Refresh