title: Good way to handle NullReferenceException before C# 6.0
body: <p>My code below gives me a <code>NullReferenceException</code> and the stack trace tells me the problem is in the <code>Count</code> method, so I'm pretty sure at some point <code>foo</code>, <code>bar</code> or <code>baz</code> is <code>null</code>.</p>
  
  <p>My code:</p>
  
  <pre><code>IQueryable&lt;IGrouping&lt;string, Referral&gt;&gt; queryable= ...;
  var dict = queryable.ToDictionary(g =&gt; g.Key.ToString(),
                                    g =&gt; g.Count(r =&gt; r.foo.bar.baz.dummy == "Success"));
  </code></pre>
  
  <p>I'm wondering what's a concise way to handle <code>null</code> cases.
  I learn that in C# 6.0 I can just do <code>foo?.bar?.baz?.dummy</code>, however the project I'm working on isn't C# 6.0</p>