c#BindingList只读错误

c#BindingList只读错误,c#,visual-studio-2010,bindinglist,C#,Visual Studio 2010,Bindinglist,我一直在寻找问题的可能原因,但似乎找不到: 错误: System.NotSupportedException:集合是只读的。在 System.ThrowHelper.ThrownNotSupportedException(例外资源 在System.Collections.ObjectModel.Collection`1.Add(T 项目)在 WindowsFormsApplication1.Form1.Btn\u CSVSEATINGPLAN\u单击(对象发送方, C:\Users\aRJiJo

我一直在寻找问题的可能原因,但似乎找不到:

错误:

System.NotSupportedException:集合是只读的。在 System.ThrowHelper.ThrownNotSupportedException(例外资源 在System.Collections.ObjectModel.Collection`1.Add(T 项目)在 WindowsFormsApplication1.Form1.Btn\u CSVSEATINGPLAN\u单击(对象发送方, C:\Users\aRJiJon\Documents\visualstudio中的事件参数 2010\Projects\WindowsFormsApplication\u 1\WindowsFormsApplication1\Form1.cs:line 七十二


有人能告诉我我遗漏了什么吗?

这意味着IList for you泛型集合类的底层实现正在为IsReadOnly属性返回true。

哦,顺便说一句,第72行是:CSV_Seating_Plan.Add(new CSV_Seating Plan());Ah找到了修复方法:而不是CSV\u Seating\u Plan=新绑定列表(容器);我刚刚得到了:CSV\u Seating\u Plan=newbindingslist(){foreach(容器中的行){在CSV\u steaingplan上添加新元素}
            this.dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 11);
            bindingCSVSP.DataSource = CSV_Seating_Plan;
            bindingCSVSP.AllowNew = true;

CSV_Seating_Plan.AllowNew = true;
CSV_Seating_Plan.AllowRemove = true;
CSV_Seating_Plan.RaiseListChangedEvents = true;
CSV_Seating_Plan.AllowEdit = true;
this.dataGridView1.DataSource = bindingCSVSP;
this.btn_Process_SP.Enabled = true;
CSV_Seating_Plan.Add(new csv_SeatingPlan());

public string examperiod;
[FieldConverter(ConverterKind.Date, "dd/mm/yyyy")]
public DateTime date_Exam;
public string time;
public string exam_Code;
public string id_Student;
public string name_Student;
public string candidatenum_Student;
public string seat_num;
public string _WSS_EXEC;
public string exam_loc;


#region getsetmethods.
public string EXAMPERIOD
{ get { return this.examperiod; } }
public DateTime DATE_TIME
{ get { return this.date_Exam; } }
public string TIME
{ get { return this.time; } }
public string EXAM_CODE
{ get { return this.exam_Code; } }
public string ID_STUDENT
{ get { return this.id_Student; } }
public string NAME_STUDENT
{ get { return this.name_Student; } }
public string CANDIDATE_NUMBER
{ get { return this.candidatenum_Student; } }
public string SEAT_NUM
{ get { return this.seat_num; } }
public string WSS_EXEC
{ get { return this._WSS_EXEC; } }
public string EXAM_LOC
{ get { return this.exam_loc; } }
#endregion

public csv_SeatingPlan()
{
}