非同步資料流的處理
http://msdn.microsoft.com/zh-tw/magazine/cc337900.aspx
其實寫了應用程式之後,發現UI真的是處處非同步啊~
重點在這裡,有遞迴呼叫的fu:
AsyncCallback rc = readResult =>
{
int read = source.EndRead(readResult);
if (read > 0)
{
destination.BeginWrite(buffer, 0, read, writeResult =>
{
destination.EndWrite(writeResult);
source.BeginRead(buffer, 0, buffer.Length, rc, null);
}
}
}
source.BeginRead(buffer, 0, buffer.Length, rc, null);
留言