gpt4 book ai didi

c# - UWP 中的 Type.IsSubclassOf

转载 作者:行者123 更新时间:2023-11-30 19:09:07 30 4
gpt4 key购买 nike

所以我正在将库从 .NET 4.5.1 移植到 UWP。

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

有什么方法可以确定某个类是否是 UWP 中某个其他类的子类?

最佳答案

部分 Type 逻辑已移至 Windows 运行时中的 TypeInfo( MSDN )。

using System.Reflection;

...

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

关于c# - UWP 中的 Type.IsSubclassOf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33691115/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com