namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Assembly assembly = Assembly.Load("ConsoleApplication1");
/*
Type[] types = assembly.GetTypes();
foreach(var item in types)
{
Console.WriteLine(item.Name);
}
* */
//要加命名空间
Type type = assembly.GetType("ConsoleApplication1.Person");
MemberInfo[] members = type.GetMembers();
foreach(var item in members)
{
Console.WriteLine(item.Name);
}
Console.ReadLine();
}
}
class Person
{
public string Name{get;set;}
}
}
|