using System;
using System.Reflection;
class Program
{
static void Main()
{
// 1. Загружаем DLL как файл
Assembly asm = Assembly.LoadFrom("MyLibrary.dll");
// 2. Находим класс внутри DLL
Type calcType = asm.GetType("MyLibrary.Calculator");
// 3. Создаём объект класса
object calc = Activator.CreateInstance(calcType);
// 4. Ввод данных
Console.Write("Введите a: ");
int a = int.Parse(Console.ReadLine());
Console.Write("Введите b: ");
int b = int.Parse(Console.ReadLine());
// 5. Вызываем метод Add
var addMethod = calcType.GetMethod("Add");
object sum = addMethod.Invoke(calc, new object[] { a, b });
// 6. Вызываем метод Multiply
var mulMethod = calcType.GetMethod("Multiply");
object mul = mulMethod.Invoke(calc, new object[] { a, b });
// 7. Вывод
Console.WriteLine("Сумма: " + sum);
Console.WriteLine("Произведение: " + mul);
Console.WriteLine("Нажми Enter для выхода...");
Console.ReadLine();
}
}