I would like to prevent further processing on an object if it is null.
In the following code I check if the object is null by either:
if (!data.Equal
C# 6 has monadic null checking :)
before:
if (points != null) { var next = points.FirstOrDefault(); if (next != null && next.X != null) return next.X; } return -1;
after:
var bestValue = points?.FirstOrDefault()?.X ?? -1;