1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
namespace Project1
{
using System;
using System.Reflection;
public class Test {
static object Add(int a, int b) {
Assembly assembly = Assembly.LoadFrom("Library1.dll");
Type type = assembly.GetType("Library1.Library1");
object target = assembly.CreateInstance("Library1.Library1");
object[] args = {a,b};
object result = type.InvokeMember("Add", BindingFlags.InvokeMethod, null, target, args);
return result;
}
public static void Main(string[] args){
Console.WriteLine("Resultat: " + Test.Add(4,8));
Console.ReadLine();
}
}
} |