C# 跨线程绑定控件数据源

 1  private void BindGrid<T, S>(List<T> t, S s) where S : GridControl
 2         {
 3             if (this.InvokeRequired)
 4             {
 5                 try
 6                 {
 7                     this.Invoke(new Action<List<T>, S>(BindGrid), new object[] { t, s });
 8                 }
 9                 catch
10                 { }
11             }
12             else
13             {
14                 try
15                 {
16                     s.DataSource = null;
17                     s.DataSource = t;
18                 }
19                 catch
20                 { }
21             }
22         }
原文地址:https://www.cnblogs.com/ZeedLee/p/8778328.html