6 | Follower
Parsing strings into other data types is always potentially fraught, what with the edge cases and possible errors. This is why most languages provide some kind of helper methods that try and solve those hard problems. C# has a number of them. One, for example, would be Int32.Parse- it attempts to parse a string into an integer, and throws an exception when it fails. Similarly, there's an Int32.TryParse function, which avoids throwing an exception and returns an error code instead.
When John takes on a new codebase, he always looks for low-risk ways to learn the code by changing it. Things like beefing up the unit tests, tracking down warnings that have been left to languish, minor quality-of-life changes. Well, a few years back, John inherited some C# code, and started tracking down some warnings. That lead to this method.
We've all been watching programming gaffes come and go, and they're almost always some variation on a set of usual themes I've been trying to classify and name. But today, we've got one for you that is amazingly, excitingly, fabulously novel! I'm calling this one ecrash unless somebody's got a better idea. Not to keep you waiting any longer than absolutely necessary, here's Ian M. with this week's winner: "I don't even know how you do search like this, it's somehow both way more complicated and way more unsettling then it needs to be."