为什么System.Reflection.IntrospectionExtensions.GetTypeInfo有无法访问的代码?

ser*_*g.f 7 .net c# .net-4.5

新的.NET4.5 API在IntrospectionExtensions类中具有以下逻辑

public static TypeInfo GetTypeInfo(this Type type)
{
  if (type == (Type) null)
    throw new ArgumentNullException("type");
  IReflectableType reflectableType = (IReflectableType) type;
  if (reflectableType == null) 
    return (TypeInfo) null; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE!
  else
    return reflectableType.GetTypeInfo();
}
Run Code Online (Sandbox Code Playgroud)

为什么这种方法无法访问代码?这是一个错误还是故意做的?

lep*_*pie 6

混淆是由类中==定义的运算符引起的Type.

如果查看IL,您将看到调用运算符而不是ReferenceEquals.

L_0002: call bool System.Type::op_Equality(class System.Type, class System.Type)
Run Code Online (Sandbox Code Playgroud)

所以代码实际上是可以达到的:)