Better way to handle null values in c#
Lets say we receive some value and it is null and we are going to use that in our code
var getValue = null; var result = getValue / 2;
if (getValue != null) { var result=getValue / 2; }
A better way could be like below:
var result= (getValue ?? 0) / 2;