Files

24 lines
758 B
C#
Raw Permalink Normal View History

2025-10-24 21:47:11 +08:00
using System.Reflection;
namespace Lesson20_反射练习
{
class Program
{
static void Main(string[] args)
{
Assembly assembly = Assembly.LoadFrom(@"D:\VisualStudio2022\VisualStudio Programe\C#\C#进阶\反射练习库\bin\Debug\反射练习库.dll");
Type[] types = assembly.GetTypes();
Console.WriteLine("______________");
for (int i = 0; i < types.Length; i++)
{
Console.WriteLine(types[i]);
}
Console.WriteLine("______________");
Type player = assembly.GetType("反射练习库.Player");
object obj = Activator.CreateInstance(player);
Console.WriteLine(obj);
}
}
}