On Adding radioButton in correctAnswer(list of RadioButton) it show System.ArgumentNullException:'Value cannot be null'
namespace QuestionPaper
{
public partial class Form1 : Form
{
RadioButton[] correctAnswers;
int result { get; set; }
public Form1()
{
InitializeComponent();
getCorrectAnswers();
}
private void getCorrectAnswers()
{
correctAnswers.Append(radioButton1);
correctAnswers.Append(radioButton5);
correctAnswers.Append(radioButton11);
correctAnswers.Append(radioButton14);
}
private void button1_Click(object sender, EventArgs e)
{
foreach (RadioButton answer in correctAnswers)
{
result = answer.Checked ? result + 1 : result;
}
label1.Text = label1.Text + " " + result.ToString();
}
}
}