首页 文章

UWP中的Type.IsSubclassOf

提问于
浏览
2

所以我将.NET从.NET 4.5.1移植到UWP .

在库中,我们使用了Type类中的方法,特别是 Type.IsSubclassOf . 但是在UWP中我找不到任何等效的方法 .

有没有办法如何找到一些类是否是UWP中其他类的子类?

1 回答

  • 11

    部分 Type 逻辑在Windows运行时移动到 TypeInfoMSDN) .

    using System.Reflection;
    
    ...
    
    bool isSubClassOf = typeof (Dog).GetTypeInfo().IsSubclassOf(typeof (Animal));
    

相关问题