多个RadionButton时的遍历:
public SettingValueList GetSettingsFromUI()
{
SettingAttribute attSelected = null;
SettingValueList svl = new SettingValueList();
for (int i = 0; i < this.groupBox1.Controls.Count; i++)
{
RadioButton cb = this.groupBox1.Controls[i] as RadioButton;
SettingValue<String> type = new SettingValue<String>(SYCHRONIZATION_TYPE, cb.Text);
if (cb.Checked == true)
{
attSelected = new SettingAttribute("selected", "true");
}
else
{
attSelected = new SettingAttribute("selected", "false");
}
type.AddAttribute(attSelected);
svl.AddSettingValue(type);
}
return svl;
}