C#WinRT Type类缺少函数

Rea*_*rld 1 c# microsoft-metro windows-runtime

我正在尝试将一些代码移植到WinRT/Metro,我遇到了一个问题,我不确定该解决的问题.似乎Type缺少IsPrimitive和IsSubclassOf(myClass)等的访问函数.有谁知道如何在Windows 8中获得此功能?

Mar*_*ell 5

那些方法被重新安置; 你需要添加一个using指令:

using System.Reflection;
Run Code Online (Sandbox Code Playgroud)

然后使用someType.GetTypeInfo().IsSubclassOf(...)someType.GetTypeInfo().IsPrimitive.

(该using指令是必要的,因为它GetTypeInfo()是一种扩展方法System.Reflection.IntrospectionExtensions).