static void Main(string[] args) { calculation cal = new calculation(); int i = cal.Add(23, 37); int i2 = cal.Sub(28, 12); Console.WriteLine("addition result is : {0}", i); Console.WriteLine("substruction result is : {0}", i2); Console.ReadLine(); }
private void button1_Click(object sender, EventArgs e) { try { int i = cal.Add(int.Parse(textBox1.Text), int.Parse(textBox2.Text)); textBox3.Text = i.ToString(); } catch (Exception ex) { MessageBox.Show("error in add button event..." + ex); } }
static void Main(string[] args) { calculation ob = new calculation(); Console.WriteLine("Diaplay : " + ob.Display()); Console.WriteLine("print : " + ob.Print()); Console.WriteLine("Addtion : " + ob.Add(10, 10)); Console.WriteLine("Subraction : " + ob.sub(10, 110)); Console.WriteLine("====================================="); Console.WriteLine("Extension methode : " + ob.exnewmethode()); ob.NewMethod(); Console.WriteLine("====================================="); Console.ReadKey(); }