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 ...
随机推荐
- js splice()方法
splice() 方法向/从数组中添加/删除项目,然后返回被删除的项目. 注释:该方法会改变原始数组. 实例 例子 1 在本例中,我们将创建一个新数组,并向其添加一个元素: <script ty ...
- 手把手教你调试Entity Framework 6源码
0 摘要 本文讲述在Visual Studio 2013(VS 2013)下调试Entity Framework 6(EF 6)源码的配置过程.原则上,VS 2012也适用. 之前打算编写<E ...
- vim删除文本文件中末行^M
^M字符的来历和作用:在DOS/Windows里,文本文件的换行符为\r\n,而在*nix系统里则为\n,所以DOS/Windows里编辑过的文本文件到了*nix里,每一行都多了个^M.所以^M只是一 ...
- 【后台管理系统】—— Ant Design Pro入门学习&项目实践笔记(三)
前言:前一篇记录了[后台管理系统]目前进展开发中遇到的一些应用点,这一篇会梳理一些自己学习Ant Design Pro源码的功能点.附:Ant Design Pro 在线预览地址. Dashboard ...
- 使RESTful Web服务更加实用的10个建议
提示:随着RESTful Web services的流行程度不断地上升,开发人员需要知道如何避免开发中的陷阱以及让开发出来的Web service达到自己能做到的最好程度. 过去的几年里,我们看到RE ...
- ubuntu14.10环境下使用apache2.2配置代理服务器
参考网址: 使用Apache架设代理服务器 ubuntu之apache正向代理及反向代理(ProxyPass\ProxyPassReverse) Apache配置正向代理与反向代理 我的配置步骤: 1 ...
- 微信小程序 - 文字走马灯
转载于csdn maid_04,总之多谢了!节省了不少时间呢 最近在做一个类似uu跑腿的项目,时间也特别紧,搞完以后再继续贴地图代码(高德.腾讯) 以下代码拷贝即可用,拿走谢谢上面的人吧(~.~) w ...
- Axure RP Extension for Chrome
1.打开Chrome浏览器,找到“更多工具 -> 扩展程序”: 2.将下载的Axure-RP-Extension-for-Chrome-0.6.2.crx文件拖到界面当中: 3.安装成功后,勾选 ...
- NYOJ1097 Ugly Numbers 【丑数】
Ugly Numbers 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描写叙述 Ugly numbers are numbers whose only prime fact ...
- C-类型转换(陷阱)
getchar() 返回值为int类型 1.自动类型转换(运算符两边变量类型不同时) 1).两个变量类型自动转换成一样的类型(会根据参数类型自动转换, 而不是直接位转换), 且运算结果也是转换后的类型 ...