原始的代码
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-02-17 08:11:52
原始的代码
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()))