title: Nested dictionary nullreferenceexception using linq and entity framework
body: <p>I'm trying to populate a dictionary using a nested select, and I get nullreference exception, since objects from TableC might not exists.</p>
  
  <pre><code>List&lt;SomeResult&gt; test = (from a in _entities.TableA
                           select new SomeResult
                           {
                              TestB = a.TableB.Name,
                              TestCDict = a.TableC.ToDictionary(x =&gt; x.SomeKey, x =&gt; x.SomeValue)
                            }).ToList();
  </code></pre>
  
  <p>How do I fix so TestCDict can be null?</p>
  
  <p>/Lasse</p>