private void button1_Click(object sender, EventArgs e) { Dele temp = null; try { switch (comboBox1.SelectedItem.ToString()) { case "+": temp = new Dele(cal.Add); break; case "-": temp = new Dele(cal.Sub); break; case "*": temp = new Dele(cal.Mul); break; case "/": temp = new Dele(cal.Div); break; } } catch { MessageBox.Show("정상적으로 입력해 주세요"); } if (temp != null && textBox2.Text != "0") temp.Invoke(int.Parse(textBox1.Text), int.Parse(textBox2.Text)); }
static void Main(string[] args) { Dele d0 = (v) => Console.WriteLine(v); d0.Invoke("OJC"); Dele d1 = new Dele(d); d1.Invoke("OJC"); Dele d2 = d; d2.Invoke("OJC"); Dele x = (z) => Console.WriteLine(z); x("aaaa"); }