我写了一个名为Section
的类,它具有2个属性:Answers
和TypeOfSection
。
因此,TypeOfSection
在DGV中可以完美显示,但是我想显示数组中每个单元的值,我该如何实现呢?
class Section
{
private int[] Answers;
private string TypeOfSection;
public Section(string TypeOfSection)
{
Answers = new int[30];
for (int i = 0; i < 30; i++)
{
this.Answers[i] = -1;
}
this.TypeOfSection = TypeOfSection;
}
public string typeOfSection
{
set { this.TypeOfSection = value; }
get { return this.TypeOfSection; }
}
public int[] answers
{
set { this.Answers = value; }
get { return this.Answers; }
}
}
这是我其余的代码:
List<Section> Psy1 = new List<Section>();
Psy1.Add(new Section("English"));
MarksDGV1.DataSource = Psy1;