Simple of Async of Multithread
private void button1\_Click(object sender, EventArgs e)
\{
button1.Text = DateTime.Now.Second.ToString();
Thread t = new Thread(new ThreadStart(NewMethod));
t.Start();
\}
private void NewMethod()
\{
AsyncCallback callback = new AsyncCallback(DataCallBack);
IAsyncResult ar = callback.BeginInvoke(null, null, null);
callback.EndInvoke(ar);
\}
public void DataCallBack(IAsyncResult ar)
\{
Thread.Sleep(3000);
MessageBox.Show(DateTime.Now.Second.ToString());
\}
转载于//www.cnblogs.com/jerryhong/archive/2009/07/07/1518544.html
还没有评论,来说两句吧...