title: Default value if null in lambda C#
body: <p>I'm trying to join three table using lambda expression. The code below is working if both tables have to match each other but if there are records without corresponding to other table it return error.<code>Object reference not set to an instance of an object.</code>  </p>
  
  <pre><code>using (WeeklyCreditEntities WCE = new WeeklyCreditEntities())
          {
              var xx = Raw.GroupJoin(WCE.tblCHRIS,
                                  a =&gt; a.CHRISID,
                                  b =&gt; b.CHRISID,
                                  (a, b) =&gt; new
                                  {
                                      raw = a,
                                      chris = b.DefaultIfEmpty().FirstOrDefault()
                                  }).Select(x =&gt; new
                                  {
                                      RawEMpid = x.raw.EmployeeID,
                                      CHRISEmpID = x.chris.EmployeeID,
                                      RawCHRISID = x.raw.CHRISID,
                                      RawFullname = x.raw.Fullname,
                                      RawAmount = x.raw.Amount,
                                      chrisBank = x.chris.BankAccount
                                  }).ToList();
  </code></pre>