确定UWP中类型的基类型

sar*_*ian 1 reflection types uwp

我正在开发Win 10应用程序。我想知道Type的BaseType。如何在uwp中使用反射来做到这一点。谢谢。

小智 5

您可以使用GetTypeInfo扩展方法获取BaceType。

Type t = typeof(int);
Type baseType = t.GetTypeInfo().BaseType; // Returns System.ValueType
Run Code Online (Sandbox Code Playgroud)