反射_程序集<14/9/2017>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;//反射需要引用命名空间
using System.Text;
using System.Threading.Tasks;
namespace 反射
{
class Program
{
static void Main(string[] args)
{
MyClass my = new MyClass();
//通过类的type对象获取它所在的程序集 Assembly
Assembly assem = my.GetType().Assembly;
Console.WriteLine(assem.FullName);
Type[] types = assem.GetTypes();
foreach(var type in types)
{
Console.WriteLine(type);
}
Console.ReadKey();
}
}
}
关于程序集