3 using System
.Threading
;
9 static void async_callback (IAsyncResult ar
)
11 byte [] buf
= (byte [])ar
.AsyncState
;
16 byte [] buf
= new byte [1];
17 AsyncCallback ac
= new AsyncCallback (async_callback
);
21 FileStream s
= new FileStream ("async_read.exe", FileMode
.Open
, FileAccess
.Read
);
25 while (s
.Read (buf
, 0, 1) == 1)
31 ar
= s
.BeginRead (buf
, 0, 1, ac
, buf
);
32 } while (s
.EndRead (ar
) == 1);
39 Console
.WriteLine ("CSUM: " + sum
+ " " + sum0
);