using System; using System.Collections.Generic; using System.Text; namespace CLibConsole { publicinterface ITest { void SysTest(); } }
using System; using System.Collections.Generic; using System.Text; using CLibConsole; namespace CLibConsole { publicclass Test : ITest { publicvoid SysTest() { System.Console.WriteLine("Hello Reflection"); } } }
using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespace CLibConsole { class Program { staticvoid Main(string[] args) { //Assembly ass = System.Reflection.Assembly.LoadFrom("CLib.dll"); //Type type = ass.GetType("CLibConsole.Test"); //Type type = System.Activator.CreateInstanceFrom("CLib.dll", "CLibConsole.Test").GetType(); ITest test = (ITest)System.Activator.CreateInstance("CLib", "CLibConsole.Test").Unwrap(); test.SysTest(); } } }