Avoiding the NullReferenceException

added by DotNetKicks
10/12/2017 2:39:24 PM

2 Kicks, 387 Views

Easily, by a landslide, the most common exception I've run into in C# is the NullReferenceException. Second would be an InvalidOperationException. But NullReferenceException wins as most occurred exception hands down. This quick post shows how we can start avoiding the NullReferenceException. I despise null. I despise null checks.