C#中的switch

switch 表达式支持的类型为 sbyte、byte、short、ushort、int、uint、long、ulong、char、string 或枚举类型,或者可以隐试转换到这些类型的自定义对象或其他内置类型。

switch(enum){

  case enum1: ... ;

  break;

  case enum2:

 

  case enum3: ... ;

 

  break;

  default: ... ;

  break;

 

}

 

posted @ 2019-09-27 01:04  盗哥泡茶去了  阅读(285)  评论(0编辑  收藏  举报