这里有对IL码的详细介绍:
ms-help://MS.VSCC/MS.MSDNVS.2052/cpref/html/frlrfSystemReflectionEmitOpCodesFieldsTopic.htm.method public hidebysig newslot virtual
instance int32 Add(object 'value') cil managed
{
// Code size 76 (0x4c)
.maxstack 3 //方法内所用到的最大stack大小的声明
.locals (int32 V_0) //局部变量列表
IL_0000: ldarg.0 //this
IL_0001: ldfld int32 System.Collections.ArrayList::_size //._size
IL_0006: ldarg.0 //this
IL_0007: ldfld object[] System.Collections.ArrayList::_items //._items
IL_000c: ldlen //.Length
IL_000d: conv.i4 //(int)
IL_000e: bne.un.s IL_001e // 如果 != 那么 跳转到 IL_001e
IL_0010: ldarg.0 //this
IL_0011: ldarg.0 //this
IL_0012: ldfld int32 System.Collections.ArrayList::_size //._size
IL_0017: ldc.i4.1 //1
IL_0018: add //+
IL_0019: call instance void System.Collections.ArrayList::EnsureCapacity(int32) //.EnsureCapacity
IL_001e: ldarg.0 //this
IL_001f: ldfld object[] System.Collections.ArrayList::_items //._items
IL_0024: ldarg.0 //this
IL_0025: ldfld int32 System.Collections.ArrayList::_size //._size
IL_002a: ldarg.1 //value
IL_002b: stelem.ref //[?]=ref
IL_002c: ldarg.0 //this
IL_002d: dup //this (复制前一项stack,也就是上面的ldarg.0的值this
IL_002e: ldfld int32 System.Collections.ArrayList::_version //._version
IL_0033: ldc.i4.1 //1
IL_0034: add //+
IL_0035: stfld int32 System.Collections.ArrayList::_version //._versiion=
IL_003a: ldarg.0 //this
IL_003b: dup //this 同上
IL_003c: ldfld int32 System.Collections.ArrayList::_size //._size
IL_0041: dup //._size
IL_0042: stloc.0 //V_0=
IL_0043: ldc.i4.1 //1
IL_0044: add //+
IL_0045: stfld int32 System.Collections.ArrayList::_size //._size=
IL_004a: ldloc.0 //V_0
IL_004b: ret //return
} // end of method ArrayList::Add翻译出来后:
public virtual int Add(object value) //Array
{
if(this._size==(int)this._items.Length)
{
this.EnsureCapacity(this._size+1);
}
this._items[this._size]=value;
this._version+=1;
return this._size++;//返回index,老的_size,新的_size-1
}
ms-help://MS.VSCC/MS.MSDNVS.2052/cpref/html/frlrfSystemReflectionEmitOpCodesFieldsTopic.htm.method public hidebysig newslot virtual
instance int32 Add(object 'value') cil managed
{
// Code size 76 (0x4c)
.maxstack 3 //方法内所用到的最大stack大小的声明
.locals (int32 V_0) //局部变量列表
IL_0000: ldarg.0 //this
IL_0001: ldfld int32 System.Collections.ArrayList::_size //._size
IL_0006: ldarg.0 //this
IL_0007: ldfld object[] System.Collections.ArrayList::_items //._items
IL_000c: ldlen //.Length
IL_000d: conv.i4 //(int)
IL_000e: bne.un.s IL_001e // 如果 != 那么 跳转到 IL_001e
IL_0010: ldarg.0 //this
IL_0011: ldarg.0 //this
IL_0012: ldfld int32 System.Collections.ArrayList::_size //._size
IL_0017: ldc.i4.1 //1
IL_0018: add //+
IL_0019: call instance void System.Collections.ArrayList::EnsureCapacity(int32) //.EnsureCapacity
IL_001e: ldarg.0 //this
IL_001f: ldfld object[] System.Collections.ArrayList::_items //._items
IL_0024: ldarg.0 //this
IL_0025: ldfld int32 System.Collections.ArrayList::_size //._size
IL_002a: ldarg.1 //value
IL_002b: stelem.ref //[?]=ref
IL_002c: ldarg.0 //this
IL_002d: dup //this (复制前一项stack,也就是上面的ldarg.0的值this
IL_002e: ldfld int32 System.Collections.ArrayList::_version //._version
IL_0033: ldc.i4.1 //1
IL_0034: add //+
IL_0035: stfld int32 System.Collections.ArrayList::_version //._versiion=
IL_003a: ldarg.0 //this
IL_003b: dup //this 同上
IL_003c: ldfld int32 System.Collections.ArrayList::_size //._size
IL_0041: dup //._size
IL_0042: stloc.0 //V_0=
IL_0043: ldc.i4.1 //1
IL_0044: add //+
IL_0045: stfld int32 System.Collections.ArrayList::_size //._size=
IL_004a: ldloc.0 //V_0
IL_004b: ret //return
} // end of method ArrayList::Add翻译出来后:
public virtual int Add(object value) //Array
{
if(this._size==(int)this._items.Length)
{
this.EnsureCapacity(this._size+1);
}
this._items[this._size]=value;
this._version+=1;
return this._size++;//返回index,老的_size,新的_size-1
}
解决方案 »
- 这样正常吗?
- 页面之间的类不能访问
- 把sql2000数据库中某张表的某个字段中的一些值替换未空的sql语句怎么写
- 如何将数据绑定到TemplateField包含的代码里
- asp.net文件写入权限的问题?
- 请问如何使window.close()直接关闭窗口而不弹出确认框呢?
- 求教在ASP.NET页面中动态的生成控件方法。
- [求救]datagrid模板列中使用linkbutton的问题
- 请问,谁有简单的ASP。NET和SQL2000的列子!急!
- 我在BRINKSTER.COM的网页,中文都成了乱码,如何解决?
- 怎样重定向页面?
- 求ComponentOne for ASP.NET的下载地址及注册码!!!
MSDN里有ILDASM的类汇编语言的详细DOCUMENT。
想懂,就去看MSDN。