title: LINQ GroupBy object with possible null values
body: <p>I have a following GroupBy query:</p>
  
  <pre><code>var groups = ordered.GroupBy(k =&gt; new
          {
              a = k[SelectedFirstCategory], 
              b = k[SelectedSecondCategory], 
              c = k[SelectedThirdCategory]
          });
  </code></pre>
  
  <p>The problem is that Categories can be null.</p>
  
  <p>How can I modify my GroupBy to accomodate for this. I know I could go with multiple "if" but that is not elegant for me.</p>
  
  <p>To make this clearer an example would be that if SelectedSecondCategory is null but other are filled than resulting grouping should be according to "a" and "c" property.
  I thought about null coalescent like this:</p>
  
  <pre><code>a = SelectedFirstCategory != null ? k[SelectedFirstCategory] : DON'T KNOW WHAT TU PUT HERE.
  </code></pre>
  
  <p>Alternative value should be something that would be irrelevant to groupBy.</p>
  
  <p>Thanks in advance.</p>