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 ...
随机推荐
- 用户文件夹在Finder中消失的问题
这个问题最早有人报告说.在升级了10.9.3的机器上.用户文件夹(/Users)会在Finder中消失.可是非常多人没有这个问题.经过多人的重复查证,最后锁定在iTunes 11.2更新上.假设用户打 ...
- 蒙皮 skin
http://help.autodesk.com/view/MAYAUL/2016/CHS/?guid=GUID-EFE68C08-9ADA-4355-8203-5D1D109DCC82 skin:顶 ...
- 对jsp中Url含中文字符的编码处理
有一段url="/app/index/index.jsp?userName='测试'":在传入到jsp页面后. 用 <% String userName=request.g ...
- Windows命令行报错:'findstr' 不是内部或外部命令,也不是可运行的程序或批处理文件
环境变量Path中追加:%SystemRoot%/system32;%SystemRoot%;
- virtualbox虚拟机ubuntu操作系统,设置网络互通、访问,能访问虚拟机swoole的http服务
网络互通 1.设置virtualbox网络连接模式为桥接网卡模式 2.重启虚拟机查看虚拟机IP ifconfig 3.开启window的telnet程序 控制面板->程序->启用或关闭wi ...
- 远程管理服务 Windows Remote Management (WS-Management)
Windows Remote Management (WS-Management) Windows 远程管理(WinRM)服务执行 WS-Management 协议来实现远程管理.WS-Managem ...
- 倍福TwinCAT(贝福Beckhoff)常见问题(FAQ)-PLC支持哪些PLC语言类型
PLC的标准化语言,统称为IEC 61131-3,该规范下有五种不同的语言可以创建PLC程序,TwinCAT都支持. IL(指令列表): 每条指令都从一个新行开始并包含一个操作和一个或多个操作数,一条 ...
- C#跨平台物联网通讯框架ServerSuperIO(SSIO)正式开源... 1
今天科技类最大的新闻,莫过于微软宣布.NET开发框架开源计划..NET 开源,集成 Clang 和 LLVM 而且自带 Android 模拟器,这意味着 Visual Studio 这个当下最好没有之 ...
- ftp mybatis
c# 字符串和Ascii码转换http://www.cnblogs.com/JoshuaDreaming/archive/2010/11/19/1882068.html ftp 公式 http://w ...
- Spring 中bean的作用、定义
Spring 中bean的作用.定义: 创建一个bean定义,其实质是用该bean定义对应的类来创建真正实例的"配方(recipe)".把bean定义看成一个配方很有意义,它与cl ...