What does GetType() return on an instance of Type?

前端 未结 3 1070
无人及你
无人及你 2021-01-24 07:52

I ran across this code during some debugging.

private bool HasBaseType(Type type, out Type baseType)
{
    Type originalType = type.GetType();
    baseType = Get         


        
3条回答
  •  天命终不由人
    2021-01-24 08:24

    The Type of a Type instance is System.RuntimeType.

        {
            Console.WriteLine(typeof(System.Type).GetType());
            Console.WriteLine(typeof(string).GetType().GetType());
            Console.WriteLine(typeof(int).GetType());
            Console.WriteLine(typeof(List).GetType());
        }
    
    System.RuntimeType 
    System.RuntimeType 
    System.RuntimeType 
    System.RuntimeType
    

提交回复
热议问题