1.
1 private void Add() 2 { 3 if (this.InvokeRequired) 4 { 5 this.Invoke(new MethodInvoker(delegate { Add(); })); 6 return; 7 } 8 //代码 9 }
2.
ThreadPool.QueueUserWorkItem(new WaitCallback((obj) => { }));
1.
1 private void Add() 2 { 3 if (this.InvokeRequired) 4 { 5 this.Invoke(new MethodInvoker(delegate { Add(); })); 6 return; 7 } 8 //代码 9 }
2.
ThreadPool.QueueUserWorkItem(new WaitCallback((obj) => { }));