原始的代码
if(ddl_GroupName.SelectedValue.ToString() == "A" || ddl_GroupName.SelectedValue.ToString() == "B" || ddl_GroupName.SelectedValue.ToString() == "C")
简化后的代码
if (new[] { "A", "B", "C" }.Contains(ddl_GroupName.SelectedValue.ToString()))
2024-01-05 11:13:16
原始的代码
if(ddl_GroupName.SelectedValue.ToString() == "A" || ddl_GroupName.SelectedValue.ToString() == "B" || ddl_GroupName.SelectedValue.ToString() == "C")
简化后的代码
if (new[] { "A", "B", "C" }.Contains(ddl_GroupName.SelectedValue.ToString()))