为什么我获取不到 GetType() 的 MethodBody?

Why can't I get the MethodBody of GetType()?

假设我有这条线:

MethodBody getTypeMethod = typeof(object).GetMethod("GetType").GetMethodBody();
// getTypeMethod is null

为什么 getTypeMethod 为空?如何获取GetType()方法的MethodBody

您自己找到了答案,但只是为了确认,Object.GetType() 是一个外部方法,外部方法没有指定方法体。

来自 C# 规范 10.6.7

When a method declaration includes an extern modifier, that method is said to be an external method. External methods are implemented externally, typically using a language other than C#. Because an external method declaration provides no actual implementation, the method-body of an external method simply consists of a semicolon.

Here 更详尽的回答。