title: How to check negative value returning from LINQ
body: <p>I am using LINQ to get my correct data,inside this LINQ am calling one method to check the date difference.If the date difference goes negative LINQ returns me anonymous type.How I can handle this and how I will get this negative number as I aslo need this to my further use.</p>
  
  <pre><code>var daysCount = (from projCount in dtExpiring.AsEnumerable()
                   where projCount.Field&lt;int&gt;("AccountId") == accId
                   &amp;&amp; (checkDate(projCount.Field&lt;DateTime&gt;("ValidFor"))) &lt;= 5
                   &amp;&amp; (checkDate(projCount.Field&lt;DateTime&gt;("ValidFor"))) &gt;= 0
                   select new { daysRemain = (checkDate(projCount.Field&lt;DateTime&gt;("ValidFor"))) }).Distinct();
  </code></pre>
  
  
  
  <pre><code>private int checkDate(DateTime validFor)
  {
      try
      {
           DateTime date = DateTime.Now;
            int diffDays = Convert.ToInt32(Math.Round((validFor - date).TotalDays));
  
            return diffDays;
        }
        catch (Exception)
        {
             return 0;
        }
   }
  </code></pre>