public Form1() { InitializeComponent(); startBC(); graphOpened = false; expressionTextBox.Select(); grafoveOkno = null; InitializeTooltips(); pamet = new string[10]; delButtons = new Button[7]; for (int i = 0; i < 10; i++) { pamet[i] = "Memory " + (1 + i).ToString(); } memoryComboBox.SelectedIndex = 0; delButtons[0] = Del0;; delButtons[1] = Del1;; delButtons[2] = Del2;; delButtons[3] = Del3;; delButtons[4] = Del4;; delButtons[5] = Del5;; delButtons[6] = Del6;; Del0.Hide(); Del1.Hide(); Del2.Hide(); Del3.Hide(); Del4.Hide(); Del5.Hide(); Del6.Hide(); favButtons = new List <Button>(); }
static void Main2() { Del2 o1 = (a, b) => a + b; Console.WriteLine(o1(1, 2)); Del3 o3 = (a, b) => b > a; Console.WriteLine(o3(1, 2)); Del4 obj4 = a => a.Basic; Console.WriteLine(obj4(new Emp { Basic = 1234 })); Del5 obj5 = a => a.Basic > 10000; Console.WriteLine(obj5(new Emp { Basic = 12345 })); Console.ReadLine(); }
static void Main(string[] args) { Del1 d = delegate() { Console.WriteLine("Display MEthod"); }; d(); Del2 d2 = delegate(int n) { Console.WriteLine($"number is {n}"); }; d2(5); Del3 d3 = delegate(string str) { return(str.ToUpper()); }; Console.WriteLine(d3("hello world")); Del4 d4 = delegate() { return(DateTime.Now.ToString()); }; Console.WriteLine(d4()); int x = 10; Del1 d5 = delegate() { Console.WriteLine(x); }; d5(); }
public void HasTarget_Static() { Del4 d = (Del4)Delegate.CreateDelegate(typeof(Del4), "5", typeof(DelegateTest).GetMethod("method4")); Assert.AreEqual(10, d(5)); }