Thread 线程占用

  new Thread(() =>
                {
                    for (int i = 0; i < this.gridView1.RowCount; i++)
                    {
                        if (this.gridView1.IsRowSelected(i) == true)

                        {
                        //string s = gridView14.GetDataRow(i)["值"].ToString();
                        //this.gridView14.GetDataRow(i)["原始值"]=textEdit39.Text.Trim();//取选中行的ID字段的值
                        this.gridView1.GetDataRow(i)["值"] = zhi;

                        }

                    }
                    DataTable Dt1 = gridControl1.DataSource as DataTable; //DataGridViewToDataTable(dataGridView1);
                                                                          //只写入更新的行
                UpdateFile(mcFile, Dt1, null);
                }).Start();

查询方法用了 new Thread(() => ).Start(); 更新功能再使用 new Thread(() => ).Start(); 提示文件被占用

因为共享冲突,所以才会有锁

UpdateFile(mcFile, Dt1, null);方法里面是不是没有关闭文件流?