Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
"may he never have to work with code like this again" that was my line you arse was it not enough to steal my internet points :/
-
If you are gonna write bad code at least make it work. Its only 8 possibilities to check for.
-
*ahem*
public string YesConverter(string yes)
{
if ("yes" == yes.ToLowercase())
return "yes";
return "no";
} -
@filthyranter
God I hope you haven't used the same approach that our legacy dev had done in any of your projects.
bool yes;
Solved. -
@delegate212 This isn't even my final form:
public string YesConverter(string yes)
{
yes = yes.Trim().ToLowerCase();
if (yes.Contains("yes") return "yes";
return "no";
}
Huehuehuehue -
Seriously tho, before replacing it by boolean logic when the surrounding system isn't fixed yet, I'd first change it to my first comment.
-
aneesh1456yAm I a noob or Did no one else notice that the function declaration name and invocation names do not match.
-
@scor I'm just mentioning you so you can read about the YesConverter once the mentions start flowing again
Immortalised this actual legacy code for our Senior Devs leaving present (we all inherited this) with his last task being to refactor it, may he never have to work with code like this again.
rant