public enum RangeItemType
{ CompanyPicker = 1, //公司STR_COMPANY
BrDivPicker = 2, //分行STR_BRDIV
DepartPicker = 3, //部门STR_DEPARTMENT
SectionPicker = 4, //科组STR_SECTION
PositionPicker = 5, //职位STR_POSITION
CategoryPicker = 6, //级别STR_CATEGORY
StaffPicker = 7, //雇员STR_STAFF
GradePicker = 8, //职级STR_GRADE
RankPicker = 9, //职阶STR_RANK
} switch (key)
{
#region Range控件
case RangeItemType.StaffPicker: //雇员
case RangeItemType.CompanyPicker: //公司
case RangeItemType.BrDivPicker: //分行
case RangeItemType.DepartPicker: //部门
case RangeItemType.SectionPicker: //科组
case RangeItemType.PositionPicker: //职位
case RangeItemType.CategoryPicker: //级别
case RangeItemType.GradePicker: //职级
case RangeItemType.RankPicker: //职阶
case RangeItemType.ContractTermsPicker: //合约条件
case RangeItemType.PayTermsPicker: //支薪条件
case RangeItemType.MedBenefitPolicyPicker: //医疗福利政策
case RangeItemType.OrgLevel1Picker: //组织层级1
case RangeItemType.OrgLevel2Picker: //组织层级2
case RangeItemType.OrgLevel3Picker: //组织层级3
case RangeItemType.OrgLevel4Picker: //组织层级4
case RangeItemType.OrgLevel5Picker: //组织层级5
case RangeItemType.OrgLevel6Picker: //组织层级6
case RangeItemType.OrgLevel7Picker: //组织层级7
case RangeItemType.OrgLevel8Picker: //组织层级8
case RangeItemType.OrgLevel9Picker: //组织层级9
case RangeItemType.OrgLevel10Picker: //组织层级10
case RangeItemType.OrgLevel11Picker: //组织层级11
case RangeItemType.OrgLevel12Picker: //组织层级12
case RangeItemType.OrgUnitPicker: //组织层级12
_returnVal = RangeClassType.RangePicker;
break;

  生成 il

IL_0010: ldloc.2
IL_0011: ldc.i4 11013
IL_0016: bgt IL_00a4

IL_001b: ldloc.2
IL_001c: ldc.i4.1
IL_001d: sub
IL_001e: switch (IL_0116, IL_0116, IL_0116, IL_0116, IL_0116, IL_0116, IL_0116, IL_0116, IL_0116)

。。。。。。

IL_0116: ldc.i4.1
IL_0117: stloc.0
IL_0118: br.s IL_012a

感觉用Sub和Switch很神奇

改成 CategoryPicker 单独 拿出来

switch (key)
{
case RangeItemType.CompanyPicker:
case RangeItemType.BrDivPicker:
case RangeItemType.DepartPicker:
case RangeItemType.SectionPicker:
case RangeItemType.PositionPicker:
case RangeItemType.StaffPicker:
case RangeItemType.GradePicker:
case RangeItemType.RankPicker:
break;
case RangeItemType.CategoryPicker:
return result;

  

il 就生成了

IL_001e: switch (IL_0116, IL_0116, IL_0116, IL_0116, IL_0116, IL_012a, IL_0116, IL_0116, IL_0116)

就变了一个  IL_012a,

不过 RangeItemType 项目 编号不连续的话,就会就变成两个 Swtich

另外 dotPeek反编译出来比较对,和源码一样。

ilspy 反编译出来变成 switch和if互相套用,有点乱

il code swtich的更多相关文章

  1. C# to IL 12 Arrays(数组)

    An array is a contiguous block of memory that stores values of the same type. These valuesare an ind ...

  2. C# to IL 10 Exception Handling(异常处理)

    Exception handling in IL is a big let down. We expected a significant amount of complexity,but were ...

  3. C# to IL 8 Methods(方法)

    The code of a data type is implemented by a method, which is executed by the ExecutionEngine. The CL ...

  4. C# to IL 6 Reference and Value Types(引用类型和值类型)

    An interface is a reference type, in spite of the fact that it has no code at all. Thus, wecannot in ...

  5. C# to IL 5 Operator Overloading(操作符重载)

    Every operator overload that we use in C#, gets converted to a function call in IL. Theoverloaded &g ...

  6. C# to IL 4 Keywords and Operators(关键字和操作符)

    Code that is placed after the return statement never gets executed. In the first programgiven below, ...

  7. C# to IL 3 Selection and Repetition(选择和重复)

    In IL, a label is a name followed by the colon sign i.e ":". It gives us the ability to ju ...

  8. C# to IL 2 IL Basics(IL基础)

    This chapter and the next couple of them will focus on and elicit a simple belief of ours,that if yo ...

  9. C# to IL 1 Introduction to Microsoft’s IL(MSIL 介绍)

    The code that we write in a programming language like C#, ASP+ or in any other .NETcompatible langua ...

随机推荐

  1. 【Hadoop】HDFS小结

  2. 从HTML5移动应用现状谈发展趋势

    时光如梭,自2008年HTML5诞生以来已经过去了5年的时间,作为新一代的Web标准,它自问世以来就受到方方面面的强烈关注,也引起了许多争议,支持者因其开放强大的特点而鼓吹它的美好前景,质疑者因其迟迟 ...

  3. 【后台管理系统】—— Ant Design Pro入门学习&项目实践笔记(三)

    前言:前一篇记录了[后台管理系统]目前进展开发中遇到的一些应用点,这一篇会梳理一些自己学习Ant Design Pro源码的功能点.附:Ant Design Pro 在线预览地址. Dashboard ...

  4. 在redhat下使用x11vnc进行桌面共享

    1.在redhat上安装x11vnc时.你须要注意下面几个方面: (1)下载x11vnc的源代码包: 网址例如以下所看到的: http://sourceforge.net/projects/libvn ...

  5. System.ExecutionEngineException: Attempting to JIT compile method System.Linq.Enumerable

    关于JIT编译和AOT编译的问题.IOS下是不支持JIT动态编译的,所以如果程序有涉及JIT编译的都会无法执行. 在google查过说unity是不支持部分的Linq功能,如Sort方法. 但我在un ...

  6. mac os x 安装adb

    http://stackoverflow.com/questions/31374085/installing-adb-on-mac-os-x Option 1 - Using Homebrew Thi ...

  7. Jmeter-性能测试(三)

    一.调通脚本(以json串Post接口为例)添加聚合报告(线程组->添加->监听器->聚合报告)并调试好需要压测的脚本,如下已经调通的P_C_B151就是我需要压测的脚本 二.设置场 ...

  8. UIAlertViewController 2

    iOS 8的新特性之一就是让接口更有适应性.更灵活,因此许多视图控制器的实现方式发生了巨大的变化.全新的UIPresentationController在实现视图控制器间的过渡动画效果和自适应设备尺寸 ...

  9. Python解微分方程

    1.求解常微分方程的步骤: from sympy import * init_printing() #定义符号常量x 与 f(x) g(x).这里的f g还可以用其他字母替换,用于表示函数 x = S ...

  10. C# NPOI操作Excel(下)

    根据自己项目需求编写,仅供参考 个人建议:使用Excel模板进行导出操作.尽量避免自己生成Excel(既繁琐又容易出BUG).大多情况下导出Excel都是固定格式,使用模板导出会方便很多. publi ...