if (Request.QueryString["UseGroups"] != null)
{
if (Request.QueryString["UseGroups"] == "True")
{
report.IncludeGroupFiltering = true;
}
else
{
report.IncludeGroupFiltering = false;
}
}
else
{
report.IncludeGroupFiltering = false;
}
if (Request.QueryString[UseGroups] != null) { if (Request.QueryString[UseGroups] == True) { report.IncludeGroupFiltering = true; }
Share
Simply a single check:
There’s no need to evaluate
Request.QueryString["UseGroups"]twice – it can only be equal to “True” if it’s non-null, and the comparison will work perfectly well (and return false) if it is null.Any solutions still doing two operations are over-complicating matters 🙂