private static void ResultReturned(IAsyncResult result) { DelegateThatReurnInt test = (DelegateThatReurnInt)result.AsyncState; int r = test(); Console.WriteLine(r); }
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); } } }