re: Are there functions similar to Ruby's `dig` in other languages? VIEW POST

FULL DISCUSSION
 

C# 6.0 and onwards gives you the Null Propagating Operator MSDN Guide — like many of the other languages here, you would use it something like:

var customerName = orders[0]?.customer?.name;

This can be combined with the null coalescing operator, to give a default value:

var customerName = orders[0]?.customer?.name ?? "No value found.";
code of conduct - report abuse