title: How to handle CopyToDataTable() when no rows?
body: <p>I have the code:</p>
  
  <pre><code>dt = collListItems.GetDataTable().AsEnumerable()
          .Where(a =&gt; Convert.ToString(a["Expertise"]).Contains(expertise) &amp;&amp; Convert.ToString(a["Office"]) == office)
           .CopyToDataTable(); 
  
  filteredCount = dt.Rows.Count();
  </code></pre>
  
  <p>How should I best handle the event when there are no rows that match? Currently I get "The source contains no DataRows" but I want to set filteredCount to 0 in that case.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Edit: I know a try..catch works but is there a more elegant way?</p>