提问人:Skobo Do 提问时间:7/12/2023 最后编辑:Guru StronSkobo Do 更新时间:7/12/2023 访问量:86
C# 了解中间语言
C# understanding intermediate language
问:
我是c#的新手。我目前正在遵循一些教程,并尝试学习如何使用 ildasm.exe 阅读中间语言 (IL)。
我用 c# 编写了这段简短的代码:
using System;
namespace MainApp
{
class App
{
public static void Main()
{
int[] array1D = new int[4];
int len = array1D.GetLength(0);
//Console.WriteLine(array1D[1]);
}
}
}
然后,我编译了代码并得到了这个 il-code:
.method public hidebysig static void Main() cil managed
{
.entrypoint
// Code size 17 (0x11)
.maxstack 2
.locals init (int32[] V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldc.i4.4
IL_0002: newarr [System.Runtime]System.Int32
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.0
IL_000a: callvirt instance int32 [System.Runtime]System.Array::GetLength(int32)
IL_000f: stloc.1
IL_0010: ret
} // end of method App::Main
我的问题: 第 7 行和第 8 行的意义何在?
答: 暂无答案
评论
nop
nop