title: operator overloading with generics
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/756954/arithmetic-operator-overloading-for-a-generic-class-in-c-sharp">Arithmetic operator overloading for a generic class in C#</a>  </p>
  </blockquote>
  
  
  
  <p>Here is the code for generic class i have created to add the complex number to overload operator.</p>
  
  <pre><code>public class Complex&lt;T&gt;
  {
      public T _a, _b;
      public Complex(T i, T j)
      {
          _a = i;
          _b = j;
      }
      public static Complex&lt;T&gt; operator +(Complex&lt;T&gt; i, Complex&lt;T&gt; j)
      {
          return new Complex&lt;T&gt;(i._a + j._a, i._b + j._b);
      }
  }
  </code></pre>
  
  <p>while working with this i have got an error of,</p>
  
  <pre><code>Error: Operator '+' cannot be applied to operands of type 'T' and 'T'
  </code></pre>
  
  <p>can any one suggest me the way i can use operator overloading with generics?</p>