两者都是返回当前的类型

1、typeof(X);    其中的 X 是类型。
2、X.GetType();    其中的 X 是变量或类型的实例。

例如:有变量 string str=new string();
   typeof表示:  typeof(string)
   GetType表示:  str.GetType() 

相关文章:

  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2021-07-29
  • 2022-01-20
  • 2022-12-23
猜你喜欢
  • 2021-09-11
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
相关资源
相似解决方案