Categories
.NET Core

Understanding the Newtonsoft JSON Token

One of the concepts worth understanding when writing a custom converter for the popular Newtonsoft JSON framework is that of the JsonToken, and the role it plays in helping you understand the JSON being read. The JsonToken documentation for Newtonsoft is relatively sparse – in part because once you understand it, it’s a relatively simple […]

Categories
.NET Core

Throw or throw ex in C#?

One common question that comes up when working with exceptions in C#, is whether or not you should re-throw an existing exception by specifying the exception, or just using the throw keyword where an error occurs. In most cases, it’s best to rethrow the existing exception, such as below: try { var networkResponse = await […]