C#:列出大会所有类 [英] C#: List All Classes in Assembly
本文介绍了C#:列出大会所有类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想输出。(编程 - C#)在我的程序集中的所有类的列表
I'd like to output (programmatically - C#) a list of all classes in my assembly.
任何提示或样品code如何做到这一点?反思?
Any hints or sample code how to do this? Reflection?
推荐答案
使用<一个href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.gettypes.aspx"><$c$c>Assembly.GetTypes$c$c>.例如:
Assembly mscorlib = typeof(string).Assembly;
foreach (Type type in mscorlib.GetTypes())
{
Console.WriteLine(type.FullName);
}
这篇关于C#:列出大会所有类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文