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. PostgreSQL on Linux 最佳部署手册

    安装常用包 # yum -y install coreutils glib2 lrzsz mpstat dstat sysstat e4fsprogs xfsprogs ntp readline-de ...

  2. python获取linux本机IP

    #!/usr/bin/env python #encoding: utf-8 #description: get local ip address import os import socket, f ...

  3. ylbtech-LanguageSamples-AnonymousDelegates(匿名委托)

    ylbtech-Microsoft-CSharpSamples:ylbtech-LanguageSamples-AnonymousDelegates(匿名委托) 1.A,示例(Sample) 返回顶部 ...

  4. Solr报错Index locked for write for core '***'. Solr now longer supports forceful unlocking via 'unlockOnStartup'

    unlockOnStartup 告知 Solr 忽略在多线程环境中用来保护索引的锁定机制.在某些情况下,索引可能会由于不正确的关机或其他错误而一直处于锁定,这就妨碍了添加和更新.将其设置为 true ...

  5. LeetCode题目:Spiral Matrix II

    原题地址:https://leetcode.com/problems/spiral-matrix-ii/ class Solution { public: vector<vector<in ...

  6. 【Python】help与dir的用法

    当你给dir()提供一个模块名字时,它返回在那个模块中定义的名字的列表.当没有为其提供参数时, 它返回当前模块中定义的名字的列表. 如果您需要快速获取任何的Python函数或语句的信息,那么您可以使用 ...

  7. jQuery 文档操作 - insertAfter() ,insertBefore(),after(),before() 方法

    这个方法跟prependTo()和appendTo()不一样的地方在于,一个是仍然插入到元素内部,而insertAfter和insertBefore是插入到元素外部. 这里拿insertBefore来 ...

  8. java中string和int互相转化 (转)

    1 如何将字串 String 转换成整数 int? A. 有两个方法: 1). int i = Integer.parseInt([String]); 或 i = Integer.parseInt([ ...

  9. excel单元格内插入选择项pass、fail、not support等

    1.点击菜单栏的数据—-->>数据验证 2.选择 序列 在 来源 选项中填入Pass,Fail,On Going,Not Support 3.在选中的单元格并在菜单栏选中 新建规则

  10. sublime test3 安装及配置

    操作系统: Ubuntu16.04 注: 除下载及安装外,其他配置不限操作系统 1. 下载及安装 官网:https://www.sublimetext.com/ 进入官网 点击 INSTALL FOR ...