Пример #1
0
        private static void ResultReturned(IAsyncResult result)
        {
            DelegateThatReurnInt test = (DelegateThatReurnInt)result.AsyncState;
            int r = test();

            Console.WriteLine(r);
        }
Пример #2
0
 public void Run()
 {
     while (true)
     {
         Thread.Sleep(500);
         if (this.events == null)
         {
             continue;
         }
         foreach (Delegate @delegate in this.events.GetInvocationList())
         {
             DelegateThatReurnInt temp = (DelegateThatReurnInt)@delegate;
             temp.BeginInvoke(new AsyncCallback(ClassWitthDelegate.ResultReturned), temp);
         }
     }
 }