public class BasicCalculation { public Int32 add(Int32 a, Int32 b) { return (a + b); } public Int32 substract(Int32 a, Int32 b) { return (a - b); } public Int32 multi(Int32 a, Int32 b) { return (a * b); } public Int32 divid(Int32 a, Int32 b) { return (a / b); } }
using MyCalculation; .....private void button1_Click(object sender, EventArgs e) { try { Int32 x = Convert.ToInt32(textBox1.Text); Int32 y = Convert.ToInt32(textBox2.Text); // Call dll MyCalculation.BasicCalculation madd = new BasicCalculation();//namespace.class Int32 z = madd.add(x, y);//class.method string ans = Convert.ToString(z); textBox3.Text = ans; } catch { textBox3.Text = "Wrong Input!"; } }