IL 静的分析ツールを作成していますが、ジェネリック型パラメーターの参照方法を管理するルールを理解するのに苦労しています。
この IL を (IList<T>
インターフェイスから)取得します。
.property instance !T Item(
int32 index
)
{
.get instance !0 System.Collections.Generic.IList`1::get_Item(int32)
.set instance void System.Collections.Generic.IList`1::set_Item(int32, !0)
}
!0
の代わりにあるのはなぜ!T
ですか? VMに関する限り、それらは同等であると思いますが、名前があることが保証されている場合に位置参照を使用するのは奇妙に思えます。
更新: KeyedCollection.ctor からの追加のケース:
IL_0037: newobj instance void class System.Collections.Generic.Dictionary`2<!TKey,!TItem>::'.ctor'(class System.Collections.Generic.IEqualityComparer`1<!0>)
IL_003c: stfld class System.Collections.Generic.Dictionary`2<!0,!1> class System.Collections.ObjectModel.KeyedCollection`2<!0,!1>::dictionary