title: Linq with safe cast and null verification
body: <p>Given the code:</p>
  
  <pre><code>from i in this.GridViewFoo.SelectedItems
  select new EmployeeEntity
  {
      EmployeeID = (i as EmployeeDto).EmployeeID,
      Email = this.GetAllEmail((i as EmployeeDto).Email, (i as EmployeeDto).SecondaryEmails),
      EmployeeNumber = (i as EmployeeDto).EmployeeNumber,
      FirstName = (i as EmployeeDto).FirstName,
      LastName = (i as EmployeeDto).LastName
  }
  </code></pre>
  
  <p>After the safe cast <code>(i as EmployeeDto)</code> may I receive a NullReferenceException. How can I ensure and safety of the code and not overload him with a lot of null checks?</p>
  
  <p><strong>Overview of solutions:</strong></p>
  
  <p>I did some tests to assert if the solutions are working. Both are working well and bring the same result, you can check <a href="http://ideone.com/MZGSK" rel="nofollow">HERE</a>. After that I did some performance tests with <a href="http://ideone.com/vum46" rel="nofollow">OfTypeSolution</a> and <a href="http://ideone.com/0SP87" rel="nofollow">letSolution</a>. </p>
  
  <p>As OfType solution have better times in average, this will be the answer!</p>