我有一个程序测试。有些问题可能有几个答案,有些问题只有一个答案。当只有一个答案时,我会针对每个问题使用此结构:Dictionary<RadioButton, bool> answers
。(bool
保存答案是真还是假?)如何执行相同操作,但使用CheckedListBox
。
问题的单独课程:
class Question
{
public Question(Label lab, Image img, Dictionary<RadioButton, bool> ans_rb, Dictionary<CheckedListBox.CheckedItemCollection, bool> ans_chb)
{
text = lab;
answers_rb = ans_rb;
isAnswered = false;
}
public Label text { get; set; }
public Dictionary<RadioButton, bool> answers_rb { get; set; }// = new Dictionary<RadioButton, bool>();
public bool isAnswered;
}