C# Winforms桌面应用程序中如何简化for循坏嵌套循环的写法?
1.6K 次浏览
string qxsz1 = "";
string qxsz2 = "";
string qxsz3 = "";
string qxsz4 = "";
for (int j = 0; j < CheckBoxList1.Items.Count; j++)
{
if (CheckBoxList1.Items[j].Selected == true)
qxsz1 += CheckBoxList1.Items[j].Value + ",";
}
for (int j = 0; j < CheckBoxList2.Items.Count; j++)
{
if (CheckBoxList2.Items[j].Selected == true)
qxsz2 += CheckBoxList2.Items[j].Value + ",";
}
for (int j = 0; j < CheckBoxList3.Items.Count; j++)
{
if (CheckBoxList3.Items[j].Selected == true)
qxsz3 += CheckBoxList3.Items[j].Value + ",";
}
for (int j = 0; j < CheckBoxList4.Items.Count; j++)
{
if (CheckBoxList4.Items[j].Selected == true)
qxsz4 += CheckBoxList4.Items[j].Value + ",";
}
string qx = qxsz1 + qxsz2 + qxsz3 + qxsz4 + qxsz5 + qxsz6 + qxsz7;
获取多个单选框选择的值 ,如何用一个循坏得到 qx
?