你如何决定是否给定类型(System.Type的)继承一个特定的基类(在.NET)? [英] How do you determine whether or not a given Type (System.Type) inherits from a specific base class (in .Net)?

查看:181
本文介绍了你如何决定是否给定类型(System.Type的)继承一个特定的基类(在.NET)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很可能将是一个简单的答案,我只是失去了一些东西,但在这里不用......如果我有一个类型,(也就是实际的System.Type ......不是实例),怎么办我判断它从另一个特定的基类型继承?

This is likely going to be an easy answer and I'm just missing something, but here goes...If I have a Type, (that is, an actual System.Type...not an instance) how do I tell if it inherits from another specific base type?

推荐答案

使用 IsSubclassOf在的System.Type 类的方法。

Use the IsSubclassOf method of the System.Type class.

这篇关于你如何决定是否给定类型(System.Type的)继承一个特定的基类(在.NET)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆