//或
Assembly assembly = Assembly.GetExecutingAssembly()//当前程序集
foreach (Type type in assembly.GetTypes())
{
Console.WriteLine(type.FullName)
//if(type.FullName.EndsWith(Student))
Console.WriteLine("found")
}
()来获取该程序集下的所有类。比如在YourLibrary.YourNamespace下有A,B,C三个类,现在在Test程序集(如:控制台程序)中遍历这三个类:using System.Reflection
namespace Test
{
public class Program
{
public static void Main(string[] args)
{
foreach(Type t in Assembly.Load("YourLibrary").GetTypes())
{
//你对这些类信息的 *** 作
//e.g:
//Console.Write(t.FullName)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)