C# – Exception filters – conditionally catch exceptions

In C# 6 they added exception filtering. This allows you to conditionally catch exceptions. To filter exceptions, you use the when clause after the catch clause, like this: Any SqlException that doesn’t meet the condition will not be caught. Previously, without exception filtering, you’d have to handle that scenario in the catch block and rethrow, … Read more C# – Exception filters – conditionally catch exceptions

C# – How to check if a type has a default constructor

A default constructor is a constructor that doesn’t have parameters. Therefore, to check if a type has a default constructor, you can use reflection to loop through the constructors and see if there are any with no parameters, like this: In this article I’ll show an example of loading types that implement a specific interface … Read more C# – How to check if a type has a default constructor

How to parse a comma-separated string from app.config

I had to parse a list of comma-separated HTTP Response Codes from the app.config file and use them to retry HTTP POST requests if the response code was contained in that list. This article explains how to parse a list of comma-separated values from the app.config and put them into a HashSet so it can … Read more How to parse a comma-separated string from app.config