DataTable多线程写不安全
如下代码: class test { private DataTable ftable; public test() { ftable = new DataTable(); DataColumn col = new DataColumn("COL_1", typeof(int)); ftable.Columns.Add(col); col = new DataColumn("COL_2", typeof(int)); ftable.Columns.Add(col); for (int i = 1; i < 100; i++) { DataRow row = ftable.NewRow(); row["COL_1"] = i; row["COL_2"] = i * 2; ftable.Rows.Add(row); } } public void AddColTest() { DataColumn col = new DataColumn("COL_Test", typeof(int)); ftable.Columns.Add(col); Parallel.For(0, ftable.Rows.Count, (index)