- namespace WindowsFormsApplication1
- {
- public partial class Form3 : Form
- {
- public Form3()
- {
- InitializeComponent();
- }
- public delegate void Delegate1();
- public delegate void Delegate2(DataTable dt);
- public void buttonFind_Click(object sender, EventArgs e)
- {
- Delegate1 d1 = new Delegate1(Find);
- d1.BeginInvoke(new AsyncCallback(AsyncCallback1), d1);
- }
- public void AsyncCallback1(IAsyncResult iAsyncResult)
- {
- Delegate1 d1 = (Delegate1)iAsyncResult.AsyncState;
- d1.EndInvoke(iAsyncResult);
- }
- public void Find()
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("name", typeof(string));
- dt.Columns.Add("age", typeof(int));
- AddRow(dt, "张三", 19);
- AddRow(dt, "张三", 19);
- AddRow(dt, "李四", 18);
- this.Invoke(new Delegate2(Bind2), new object[] { dt });
- }
- public void AddRow(DataTable dt, string name, int age)
- {
- DataRow dr = dt.NewRow();
- dr["name"] = name;
- dr["age"] = age;
- dt.Rows.Add(dr);
- }
- public void Bind2(DataTable dt)
- {
- this.dataGridView1.DataSource = dt;
- }
- }
http://blog.csdn.net/loveandangle/article/details/6733642
c# 多线程排队队列实现的源码,布布扣,bubuko.com
c# 多线程排队队列实现的源码
原文:http://www.cnblogs.com/mili3/p/3782594.html