Alex Rivera | Logout

Can anyone think of an elegant way of reducing this nested if-else statement?

Asked 2010-07-30T20:01:56.633
13
if (Request.QueryString["UseGroups"] != null)
{
  if (Request.QueryString["UseGroups"] == "True")
  {
    report.IncludeGroupFiltering = true;
  }
  else
  {
    report.IncludeGroupFiltering = false;
  }
}
else
{
  report.IncludeGroupFiltering = false;
}
c#
Edit
Report

1 Answer

0
 report.IncludeGroupFiltering = (Request.QueryString["UseGroups"] != null) 
                                && (Request.QueryString["UseGroups"] == "True");
answered 2010-07-30T20:04:15.927

Your Answer