private void ResultReturned(IAsyncResult iar) { DelegateThatReturnsInt del = (DelegateThatReturnsInt)iar.AsyncState; int result = del.EndInvoke(iar); Console.WriteLine("Delegate returned result: {0}", result); }
} // end run // call back method to capture results private void ResultsReturned(IAsyncResult iar) { // cast the state object back to the delegate type DelegateThatReturnsInt del = ( DelegateThatReturnsInt )iar.AsyncState; // call EndInvoke on the delegate to get the results int result = del.EndInvoke(iar); // display the results Console.WriteLine("Delegate returned result: {0}", result); }
//poziva metodu za uzimanje rezultat private void ResultsReturned(IAsyncResult iar) { //pretvara objekat stanja natrag u tip delegata DelegateThatReturnsInt del = (DelegateThatReturnsInt)iar.AsyncState; //poziva EndInvoke na delegatu da uzme rezultat int result = del.EndInvoke(iar); //prikazuje rezultate Console.WriteLine("Delegate returned result: {0}", result); }