We've seen this pattern many times here:
return (someCondition) ? true : false;
or
if (someCondition)
{
return true;
}
else
{
return false;
}
There are many variations on it, all of which highlight someone's misunderstanding of boolean expressions. Today Kerry sends us a "fun" little twist, in C#.
return (someCondition || someOtherCondition) ? Boolean.Parse("true") : Boolean.Parse("false");
The conditions have been elided by Kerry, but they're long and complicated, rendering the statement less readable than it appears here.
But here we've taken the "if-condition-return-condition" pattern and added needless string parsing to it.
[Advertisement]
Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.