Reflection DLL
RM50Man
- Messages postés
-
314
- Date d'inscription
- mercredi 1 novembre 2000
- Statut
- Membre
- Dernière intervention
- 20 août 2006
-
cs_Bidou
- Messages postés
-
5487
- Date d'inscription
- dimanche 4 août 2002
- Statut
- Modérateur
- Dernière intervention
- 20 juin 2013
-
Voila le code ou j utilise la reflection pour appeler une méthode static
dans ma DLL
Assembly asm = Assembly.LoadFrom("PremiereDLL.dll");
Type[] types = asm.GetTypes();
object[] arg =
new
object[2];
arg[0] = 1;
arg[1] = 2;
int i = (
int)(types[0].InvokeMember("Addition",BindingFlags.InvokeMethod|BindingFlags.Static,
null,
null,arg));
richTextBox1.Text = i.ToString();
Voici la methode ds la dll
using System
;
namespace PremiereDLL
{
/// <summary>
/// Description of MyClass.
/// </summary>
public class MyClass
{
public static int Addition(int a
,int b
)
{
return(a
+b
);
}
}
}
je comprend pas pourkoi ca marche pas !!
si kelkun peut m aider!!!!!!!
Ca met methode introuvable!!!
RM50man