Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

can you have multiple statement in a case c#

switch (value)
{
    case 1: case 2: case 3:          
        // Do Something
        break;
    case 4: case 5: case 6: 
        // Do Something
        break;
    default:
        // Do Something
        break;
}
Comment

multi case in c#

switch (value)
{
   case var s when new[] { 1,2,3 }.Contains(s):
      // Do something
      break;
   case var s when new[] { 4,5,6 }.Contains(s):
      // Do something
      break;
   default:
      // Do the default
      break;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: C# check if object is default 
Csharp :: unity how to find the largest value out of 2 numbers 
Csharp :: v-slot 
Csharp :: c# progress bar timer 
Csharp :: print hello world in unity 
Csharp :: stop playing audiosource 
Csharp :: c# if string in licbox 
Csharp :: sort array dotnet 
Csharp :: blazor image button 
Csharp :: c# asp.net hover tooltip 
Csharp :: how to make a system to check if i see certain object in unity 
Csharp :: c# get executing file name 
Csharp :: browser folder in wpf 
Csharp :: Response.Redirect cannot be called in a Page callback 
Csharp :: generate a dropdown list from array data using razor .net mvc 
Csharp :: c# datagridview center cell text 
Csharp :: vb.net drag window without titlebar 
Csharp :: array sum c# 
Csharp :: escape chars for regex c# 
Csharp :: remove all values from list c# 
Csharp :: c# get all id of list object 
Csharp :: install active directory windows server 2019 powershell 
Csharp :: value is null to insert in c# 
Csharp :: datatable in c# 
Csharp :: unity unit testing 
Csharp :: c# delete object 
Csharp :: RestRequest AdvancedResponseWriter site:stackoverflow.com 
Csharp :: dadar pincode 
Csharp :: O thread de chamada não pode aceder a este objecto porque existe outro thread que já o tem 
Csharp :: gcm_sender_id convert text 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =