2 using System
.Threading
;
3 using System
.Runtime
.InteropServices
;
6 delegate int SimpleDelegate (int a
);
8 static int Method (int a
) {
12 static void Callback (IAsyncResult ar
)
17 SimpleDelegate d1
= new SimpleDelegate (Method
);
18 SimpleDelegate d2
= new SimpleDelegate (Method
);
20 AsyncCallback ac
= new AsyncCallback (Callback
);
22 IAsyncResult ar1
= d1
.BeginInvoke (1, ac
, null);
23 IAsyncResult ar2
= d2
.BeginInvoke (2, ac
, null);
28 } catch (InvalidOperationException
) {
35 } catch (InvalidOperationException
) {
39 if (1 != d1
.EndInvoke (ar1
)) return 3;
40 if (2 != d2
.EndInvoke (ar2
)) return 4;