2 using System
.Threading
;
3 using System
.Runtime
.InteropServices
;
6 delegate int SimpleDelegate (int a
);
8 static int cb_state
= 0;
10 static int F (int a
) {
11 Console
.WriteLine ("Test.F from delegate: " + a
);
12 throw new NotImplementedException ();
15 static void async_callback (IAsyncResult ar
)
17 Console
.WriteLine ("Async Callback " + ar
.AsyncState
);
19 throw new NotImplementedException ();
23 SimpleDelegate d
= new SimpleDelegate (F
);
24 AsyncCallback ac
= new AsyncCallback (async_callback
);
25 string state1
= "STATE1";
28 IAsyncResult ar1
= d
.BeginInvoke (1, ac
, state1
);
30 ar1
.AsyncWaitHandle
.WaitOne ();
33 res
= d
.EndInvoke (ar1
);
38 } catch (NotImplementedException
) {
40 Console
.WriteLine ("received exception ... OK");