Geeks With Blogs
HanSolo code monkey October 2009 Entries
Writing to a file asynchronously
Here is a code snippet for writing to a file asynchronously: private void writeFileAsync(string text) { System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); byte[] buffer = encoding.GetBytes(text); using (FileStream fs = new FileStream("temp.txt", FileMode.Append, FileAccess.Write, FileShare.ReadWrite, buffer.Length, FileOptions.Asynchronous)) { IAsyncResult asyncResult = fs.BeginWrite(buffer, 0, buffer.Length, new AsyncCallback(EndWriteCallb... new State()); } } private void EndWriteCallback(IAsyncResult ......

Posted On Thursday, October 15, 2009 1:48 PM

Copyright © HanSolo | Powered by: