title: overloading operator for DateTime in .net
body: <p>I <strong>need</strong> to do this in .net because this Date + Number code is from a converted old VB6 code, and these are not typed, so I can't detect when it happens in compilation time. So I'm searching for a solution which I don't need to know when it occurs everywhere in my code.</p>
  
  <pre><code>DateTime date = DateTime.Now + 1
  </code></pre>
  
  <p>to when I receive a number I sum it as days in a date, so I started making this:</p>
  
  <pre><code>public static DateTime operator +(DateTime c1, int c2)
  {
      return c1.AddDays(c2);
  }
  </code></pre>
  
  <p>However it throws this error:</p>
  
  <blockquote>
    <p>One of the parameters of a binary operator must be the containing type</p>
  </blockquote>
  
  <p>How can I achive this Datetime + Int operator?</p>
  
  <p><strong>EDIT after choosing correct answer:</strong></p>
  
  <ol>
  <li><p>I'm choosing @Marc Gravell 's answer, because he explained that I want to do is impossible, and he gaves a cleaner solution better than casting unknown types and using <code>.AddDays</code> by hand everywhere</p></li>
  <li><p>If you having the same trouble because you can't detect these untyped errors at compile type, @Matt Wilko gave an awesome clue turning turning <em>Option Strict Off</em> that VB.Net made at conversion from VB6 to <em>On</em>. It won't resolve the problems since it'll detect as errors even when I were doing a Number + Number operation, however it helps a lot to find when a Date + Number would occur at compile time. After solving the Date + Number problems, I'll turn <em>Option Strict</em> to <em>Off</em> again.</p></li>
  </ol>
  
  <p>Thank you both guys!</p>