[c#] assembly CreateInstance
Bonsoir,
j'ai un petit problème avec la méthode CreateInstance.
Celle-ci retourne null.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
private void LoadAssemblies()
{
DirectoryInfo Dir = new DirectoryInfo(Initialisation.Dll);
foreach (FileInfo File in Dir.GetFiles("*.Command.dll"))
{
Assembly Assemb = Assembly.LoadFrom(File.FullName);
foreach (Type Typ in Assemb.GetTypes())
{
if (Typ.IsInterface == false)
{
this._map[Typ.Name] = Assemb;
}
}
}
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
if (this._map.ContainsKey(Commande))
{
try
{
Command Cmd = (Command)this._map[Commande].CreateInstance(Commande, true);
}
catch (Exception)
{
}
} |
Cmd vaut toujours null.
Avez-vous une idee d'ou cela peut venir ?
Merci d'avance.
Cordialement,
NeoKript