optional chaining conditional casting c# code example
Example 1: c# null conditional
//Return stirng representation of nullable DateTime
DateTime? x = null;
return x.HasValue == true ? x.Value.ToString() : "No Date";
Example 2: c# null accessor
int? length = people?.Length; // null if people is null