Mic*_*ync 34 .net c# reflection microsoft-metro windows-runtime
是否有任何替代IsSubclassOf或IsAssignableFrom在C#Metro风格?
我正在尝试使这个代码在Metro上运行,但无法找到替代方案.
if ((ui.GetType() == type) || (ui.GetType().IsSubclassOf(type)))
{
return true;
}
Run Code Online (Sandbox Code Playgroud)
Jam*_*lis 55
许多反射方法都可以在System.Reflection.TypeInfo课堂上找到.
你可以得到的一个实例,TypeInfo您的Type使用GetTypeInfo扩展方法,提供System.Reflection.IntrospectionExtensions:
using System.Reflection;
// ...
ui.GetType().GetTypeInfo().IsSubclassOf(type)
Run Code Online (Sandbox Code Playgroud)
小智 17
你可以用这个:
using System.Reflection;
// ...
ui.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo());
Run Code Online (Sandbox Code Playgroud)
这适用于Metro.
| 归档时间: |
|
| 查看次数: |
9277 次 |
| 最近记录: |