10.1. Fundamentals of the try-catch-finally Construct

Instead of listing all the permutations of the try-catch-finally construct, we will work through the combinations by starting with a routine programming problem: efficiently determining whether a string can be parsed to a double value. If you're a procedural programmer, you probably tackle this by first iterating through the characters of the string and checking whether each character is a valid numeric or decimal point or has specific symbols such as E, +, /, or -. You then check whether the decimal point and the symbols are positioned correctly inside the string and ensure that they do not occur more than once. Then you must find whether the value is within the min-max range for a double. ...

Get .NET for Java Developers: Migrating to C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.