title: Nullable DateTime extension throws 'does not contain a definition' exception
body: <p>In the code below:</p>
  
  <pre><code>void Main()
  {
      DateTime cleanDate = DateTime.Now.ToCleanDateTime();    
      DateTime? nullableCleanDate = DateTime.Now;
      nullableCleanDate = nullableCleanDate.ToCleanDateTime();
  
      cleanDate.Dump();
      nullableCleanDate.Dump();
  }
  
  public static class Extensions
  {
      //public static DateTime ToCleanDateTime(this DateTime dt)
      //{
      //  dt = new DateTime(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0);
      //  return dt;
      //}
  
      public static DateTime? ToCleanDateTime(this DateTime? dt)
      {
          if (dt.HasValue)
              dt = new DateTime(dt.Value.Year, dt.Value.Month, dt.Value.Day, 0, 0, 0, 0);
          return dt;
      }
  }
  </code></pre>
  
  <p>This line <code>DateTime cleanDate = DateTime.Now.ToCleanDateTime();</code> throws following exception. </p>
  
  <blockquote>
    <p>'System.DateTime' does not contain a definition for 'ToCleanDateTime'
    and the best extension method overload
    'Extensions.ToCleanDateTime(System.DateTime?)' has some invalid
    arguments</p>
  </blockquote>
  
  <p>If I comment in extension method for <code>DateTime</code> <code>public static DateTime ToCleanDateTime(this DateTime dt)</code> error is not thrown. </p>
  
  <p>Could anyone enlighten me with:</p>
  
  <ol>
  <li>Why is this error thrown (aside from the obvious)? </li>
  <li>Is there a way to combine these two extensions into single method?</li>
  </ol>
  
  <p>I somehow expected <code>public static DateTime? ToCleanDateTime(this DateTime? dt)</code> to handle both <code>DateTime</code> and <code>DateTime?</code>.</p>