[Mono-list] assembly loaded at runtime and object instance creation
LordPhoenix
lordphoenix at free.fr
Fri May 28 05:36:19 EDT 2010
Hi all,
I'm trying to create object from an assembly wich I'm loading at
runtime. Here is code I'm using:
In my loaded assembly :
using System;
namespace test{
public class Plugin{
public Plugin(){}
public void MethodeTest(){
Console.WriteLine("Appel de la méthode de test");
}
}
}
compiled as a library of course.
and in my main program wich must load assembly
using System;
using System.Reflection;
namespace test{
class Loader{
public Loader(){
Assembly ass = Assembly.LoadFrom("plugin.dll");
Console.WriteLine(ass.FullName);
System.Object obj = ass.CreateInstance("Plugin",false);
if(obj==null)
Console.WriteLine("fail");
else
Console.WriteLine("OK");
}
public static void Main (string[] args){
new Loader();
}
}
}
and the output is always "fail".
How can do this? What did I miss?
Thanks for help.
PS Sorry for my bad English I don't speak it very often.
More information about the Mono-list
mailing list