class GetTypes
{
public static string Go()
{
StringWriter strWriter = new StringWriter();
Console.SetOut(strWriter);
//获取 mscorlib 程序集, 它是在其中定义的一个对象
Assembly a = typeof(Object).Module.Assembly;
//获取此程序集中的所有类型
Type [] types = a.GetTypes ();
//让我们来看看它们,并在执行时收集一点数据。
int numValueTypes = 0;
int numInterfaces = 0;
int numClasses = 0;
int numArrays = 0;
Console.WriteLine ("从程序集“{0}”中获取所有类型", a.GetName());
Console.WriteLine("将只列出接口类型。");
Console.WriteLine ("----------------------------------");
foreach (Type t in types)
{
if (t.IsClass) numClasses++;
if (t.IsValueType) numValueTypes++;
if (t.IsArray) numArrays++;