I have the following ugly code:
if (msg == null || msg.Content == null || msg.Content.AccountMarketMessage == null || msg.Content.AccountMarke
One of the proposals in C# 6 would be to add a new Null Propogation operator.
This will (hopefully) allow you to write:
var obj = msg?.Content?.AccountMarketMessage?.Account?.sObject; if (obj == null) return;
Unfortunately, there is nothing in the language at this point that handles this.