原始的代碼ide
if(ddl_GroupName.SelectedValue.ToString() == "A" || ddl_GroupName.SelectedValue.ToString() == "B" || ddl_GroupName.SelectedValue.ToString() == "C")
簡化後的代碼it
if (new[] { "A", "B", "C" }.Contains(ddl_GroupName.SelectedValue.ToString()))