我一直在查看 IL 中的显式接口实现。Method
以下类中的方法(接口IA
上有一个Method()
):
public class B : IA
object IA.Method() {
/* code */
}
}
编译为以下 IL 方法签名:
.method private hidebysig newslot virtual final instance object IA.Method() cil managed {
.override IA::Method
/* code */
}
我的问题是 - 为什么在 IL 中的方法名称IA.Method()
,而不仅仅是直Method
?这实际上意味着什么,如果错过了它为什么不起作用?我在 ECMA 规范或谷歌中找不到任何关于它的内容。