24 lines
758 B
C#
24 lines
758 B
C#
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);
|
|
}
|
|
}
|
|
}
|