Tag: csharp6

Guidelines for Exception Handling in C#

The following is a list of C# Exceptions Handling Guidelines taken from Essential C# by Mark Michaelis. Exception handling provides much-needed structure to the error-handling mechanisms that preceded it. However, it can still lead to some unwieldy results if used haphazardly. The following guidelines offer some best practices for exception handling. Catch only the exceptions […]

The CIL of C# 6.0’s String Interpolation

One of the C# 6.0 features that will most simply and perhaps most predominantly affect the way you write C# code in the future is string interpolation.  Besides explaining composite string formatting (the old way – string.Format(“{0} {1}”, firstName, lastName) ) or obviously being relegated to a pre-C# 6.0 world, there is little reason to revert […]

Exception Handling Improvements in C# 6.0

There are two new exception-handling features in C# 6.0.  The first is an improvement in the async and await syntax and the second is support for exception filtering. When C# 5.0 introduced the async and await (contextual) keywords, developers gained a relatively easy way to code the Task-based Asynchronous Pattern (TAP) in which the compiler […]