il code swtich
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的更多相关文章
- C# to IL 12 Arrays(数组)
An array is a contiguous block of memory that stores values of the same type. These valuesare an ind ...
- C# to IL 10 Exception Handling(异常处理)
Exception handling in IL is a big let down. We expected a significant amount of complexity,but were ...
- C# to IL 8 Methods(方法)
The code of a data type is implemented by a method, which is executed by the ExecutionEngine. The CL ...
- 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 ...
- C# to IL 5 Operator Overloading(操作符重载)
Every operator overload that we use in C#, gets converted to a function call in IL. Theoverloaded &g ...
- C# to IL 4 Keywords and Operators(关键字和操作符)
Code that is placed after the return statement never gets executed. In the first programgiven below, ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- 从C转到JAVA学习路之struct与class对比(转)
转自:http://blog.csdn.net/andywxf01/article/details/53506549 JAVA里最牛B的最基本的就是类,而C语言中的struct也可以定义自己的数据结构 ...
- Guice 学习(五)多接口的实现( Many Interface Implementation)
1.接口 /* * Creation : 2015年6月30日 */ package com.guice.InterfaceManyImpl; public interface Service { p ...
- 对帝国cms、dedecms、phpcms等负载测试总结
来自:http://www.chinaz.com/web/2013/0729/311360.shtml 担心被骂,本不想写这篇文章.犹豫良久,最终还是决定写.希望能够帮助到一些朋友,认识到数据库索引正 ...
- scanf函数具体解释与缓冲区
1.基本信息 函数原型: int scanf( char *format, args, ...); 函数返回值: 读入并赋给args的数据个数.遇到文件结束返回EOF,出错返回0. 函数功能: sca ...
- IOS高级面试题
1.写一下UIButton与UITableView的层级结构 2.Cocoa的Foundation对象与Core Foundation对象通过什么keyword进行转换?这些keyword有什么差别 ...
- Selenium2 Python 自己主动化測试实战学习笔记(五)
7.1 自己主动化測试用例 无论是功能測试.性能測试和自己主动化測试时都须要编写測试用例,測试用例的好坏能准确的体现了測试人员的经验.能力以及对项目的深度理解. 7.1.1 手工測试用例与自己主动化測 ...
- 关于升级 phpStudy 中 MySQL 版本至 5.7.17
mysql版本低于5.6 自动更新时间会报错.因此要升级mysql版本.综合网上资料和实际过程中遇到的问题,具体细节和注意事项如下: 1.从官网上下载高版本的 MySQL :https://dev.m ...
- Spring简化配置
一.提取公共配置 通过bean标签将公共的配置提取出来,然后指定abstract="true". 在其它bean标签中指定其parent就可以.
- 用brew安装gcc48
由于mac自带的gcc的版本过低,因此想自己装一个新的gcc. 在网上搜索了一圈后发现用brew install安装比较简单,但可能由于本地的brew有冲突,因此网上的攻略都没有效果. 通过在gith ...
- JAVA WEB项目开发案例精粹
http://www.blogjava.net/zongbao/archive/2012/07/24/383884.htmlJAVA WEB项目开发案例精粹.pdf main Alt + / => ...