static void Main(string[] args) { Console.WriteLine("Введите длину массива"); int n = int.Parse(Console.ReadLine()); simpleDelegate[] SDArray = new simpleDelegate[n]; for (var i = 0; i < SDArray.Length; i++) { SDArray[i] = new simpleDelegate(RndMethod); } anonDelegate anonDelegate = SDArr => { var sum = 0; foreach (var deleg in SDArray) { sum += deleg(); } return(sum / 10); }; Console.WriteLine(anonDelegate(SDArray)); Console.ReadKey(); }
static void Main(string[] args) { // function1(500); // function2(500); simpleDelegate mysimpleDelegate_1 = new simpleDelegate(function1); simpleDelegate mysimpleDelegate_2 = new simpleDelegate(function2); // mysimpleDelegate_1(500); // mysimpleDelegate_2(500); // mysimpleDelegate_1.Invoke(500); // mysimpleDelegate_2.Invoke(500); mysimpleDelegate_1.BeginInvoke(500, null, null); mysimpleDelegate_2.BeginInvoke(500, null, null); Console.Read(); }
public static void Main() { Hello12 hw = new Hello12(); simpleDelegate d = new simpleDelegate(hw.print); d(); }