使用WinForms;有没有更好的方法来查找群组中选中的RadioButton?我认为下面的代码不应该是必要的。当您选择不同的RadioButton时,它知道应取消哪一个……因此它应该知道哪个已被选中。如何在不进行大量if语句(或switch)的情况下获取该信息。
RadioButton rb = null;
if (m_RadioButton1.Checked == true)
{
rb = m_RadioButton1;
}
else if (m_RadioButton2.Checked == true)
{
rb = m_RadioButton2;
}
else if (m_RadioButton3.Checked == true)
{
rb = m_RadioButton3;
}