Previous Versions Previously in C#, references have been allowed to be null and they could be de-referenced without null checks. We would then get a NullReferenceException, this happens when we dereference a variable which is set to null. Sometimes we have nulls coming from other parts of the code, which we then discover later when […]
Tag: .NetCore
Read-only Auto Properties
In this article I discuss read-only automatic properties. I am going to cover how automatic properties have changed over the releases of C# and along the way show how much more concise the code becomes. Automatic Properties Ever since C# 3.0 came out we had the ability to define automatic properties. Gone were the days […]
C# Expression Bodied Members
We first saw expression bodied members introduced in C# 6. This introduced the ability to take a single expression method and read-only property and reduce it to a more concise form. Functions For example a single line function can be reduced from this: To the following code below: Read-only Properties A read-only property can be […]