Tag: csharp6

Guidelines for Exception Handling in C#

Best Practices for Exception Handling 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 […]

The CIL of C# 6.0’s String Interpolation

Effects of 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 […]

Exception Handling Improvements in C# 6.0

Support for Exception Filtering and More 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 […]

Static Using Statement in C# 6.0

Exploring Using Static in C# 6.0 Another C# 6.0 “syntactic sugar” feature is the introduction of using static.  With this feature, it’s possible to eliminate an explicit reference to the type when invoking a static method.  Furthermore, using static lets you introduce only the extension methods on a specific class, rather than all extension methods […]