Evaluate Expressions in Switch Statements in C#

前端 未结 12 463
抹茶落季
抹茶落季 2021-01-31 01:42

I have to implement the following in a switch statement:

switch(num)
{
  case 4:
    // some code ;
    break;
  case 3:
    // some code ;
    brea         


        
12条回答
  •  离开以前
    2021-01-31 02:14

    The other way around would be possible also (relating to Jon Skeet's answer):

    switch(num)
    {
      case a:
          break;
      default:
          if( num < 0 )
          {}
       break;
    }
    

提交回复
热议问题