有没有办法让在C#innerclasses的名单? [英] Is there a way to get a list of innerclasses in C#?

查看:102
本文介绍了有没有办法让在C#innerclasses的名单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照标题。我想所有的内部类给定类的列表,也可以是名称的列表或一个类型列表 - 我不是大惊小怪。这可能吗?我想有可能是使用反射的方式,但一直没能找到一个。

As per the title. I'd like a list of all the inner classes of a given class, it can be a list of names or a list of types - I am not fussed. Is this possible? I thought there might be a way using reflection but haven't been able to find one.

非常感谢, 托马斯

推荐答案

您想要 Type.GetNestedTypes 。这会给你的类型,然后你就可以查询自己的名字列表。

You want Type.GetNestedTypes. This will give you the list of types, which you can then query for their names.

这篇关于有没有办法让在C#innerclasses的名单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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