Skip to content

Instantly share code, notes, and snippets.

@baobao
Last active December 7, 2018 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baobao/1775be961afa71601c495c30140191ea to your computer and use it in GitHub Desktop.
Save baobao/1775be961afa71601c495c30140191ea to your computer and use it in GitHub Desktop.
// フィールド変数instanceVaribale定義
.field private string instanceVaribale
// Mainメソッド定義
.method public hidebysig
instance void Main () cil managed
{
.maxstack 8
// 自分自身の参照をスタックに乗せる
IL_0000: ldarg.0
// instanceVaiableの値をスタックに乗せる
IL_0001: ldfld string Csharp::instanceVaribale
// Console.WriteLine実行
IL_0006: call void [mscorlib]System.Console::WriteLine(string)
IL_000b: ret
}
// コンストラクタ
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
.maxstack 8
// 自分自身の参照をスタックに乗せる
IL_0000: ldarg.0
// "hoge"をスタックに乗せる
IL_0001: ldstr "hoge"
// string型のフィールドinstanceVaribaleの値が"hoge"に上書きされます
IL_0006: stfld string Csharp::instanceVaribale
// 自分自身の参照をスタックに乗せる
IL_000b: ldarg.0
// 親クラスのコンストラクタを実行
IL_000c: call instance void [mscorlib]System.Object::.ctor()
IL_0011: ret
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment