[Aync Method invokes]
// CLR will create a background work thread automatically
// !Create a delegate at first // public delegate void AsyncEventHandler(int nLook); // !...
// private System.IO.StreamWriter m_sr =
// new System.IO.StreamWriter(@"D:/AsyncTest.log");
// !... Program pro = new Program(); AsyncEventHandler asy = pro.foo; IAsyncResult ia = asy.BeginInvoke(500,null, null); for(int ___i=0;___i<100;___i++) { pro.m_sr.WriteLine("___i = {0}/n", ___i); Thread.Sleep(1); } // waiting for invoke end asy.EndInvoke(ia); pro.m_sr.Close();