我的程序无法确定是Math.Round
作为 adecimal
还是 a执行double
,但我不知道如何解决这个问题......这是我的代码,虽然倒数第二行是我所关心的。
ArrayList topp1 = new ArrayList();
int toppcount = 0;
foreach (Control cb in GroupBoxH1T.Controls)
{
CheckBox cb1 = cb as CheckBox;
if (cb1.Checked == true)
{
toppcount++;
topp1.Add(cb1.Text);
}
}
if (cbhwchoice.Checked == false)
{
ArrayList topp2 = new ArrayList();
foreach (Control cb in GroupBoxH2T.Controls)
{
CheckBox cb1 = cb as CheckBox;
if (cb1.Checked == true)
{
toppcount++;
topp2.Add(cb1.Text);
}
}
toppcount = Math.Round((toppcount/2,MidpointRounding.AwayFromZero);
}