Error handling in .NET Part 2: The Try and the Result patterns

Alternatives to the Exception pattern In my last article, I wrote about the exception pattern. It has great benefits but also great performance implications. Because of these, and following Microsoft recommendations, I’ve also written that we should only use them for exceptional errors. So what do we do when we have to handle an error? Let’s get to it. The “Check and Do” pattern Disclaimer: I’ll include this pattern just for completeness....

February 1, 2024 · 6 min