using System; using System.Reflection; using System.Runtime.Remoting; class App { static void Main() { object obj = null; try { obj = UsePartialName("lib"); InvokeObject(obj); } catch(Exception e1) { Console.WriteLine(e1.GetType().ToString()); } } static object UsePartialName(string name) { Assembly a = Assembly.LoadWithPartialName(name); Type type = a.GetType("LibraryCode"); ConstructorInfo ctor = type.GetConstructor(Type.EmptyTypes); return ctor.Invoke(null); } static void InvokeObject(object obj) { Type type = obj.GetType(); MethodInfo mi = type.GetMethod("GetVersion"); string version = (string)mi.Invoke(obj, null); Console.WriteLine(version); } }