title: How to compare two generic types?
body: <p>I make my class generic.The T - can be string or int.</p>
  
  <p>I have this feature class:  </p>
  
  <pre><code>public class Feature&lt;T&gt;// : IComparable
  {
      public T CurrentFeatureCode { get; set; }
  
      public T StreetCode1 { get; set; }
      public T BuildingNumber1 { get; set; }
      public string BuildingLetter1 { get; set; }
  
      public T StreetCode2 { get; set; }
      public T BuildingNumber2 { get; set; }
      public string BuildingLetter2 { get; set; }
  
      public double CoordinateX { get; set; }
      public double CoordinateY { get; set; }
  
      public string Filter { get; set; }
  
      public string ToString(T streetCode)
      {
          return StreetCode2 == streetCode ? String.Format("{0}{1}", BuildingNumber2, BuildingLetter2) : String.Format("{0}{1}", BuildingNumber1, BuildingLetter1);
      }
  }
  </code></pre>
  
  <p>As you can see I have ToString method inside Feature class that compares two values:</p>
  
  <pre><code>StreetCode2 == streetCode ? String.Format("{0}{1}", BuildingNumber2, BuildingLetter2) : String.Format("{0}{1}", BuildingNumber1, BuildingLetter1);
  </code></pre>
  
  <p>I  get error on this row:</p>
  
  <pre><code>Error   11  Operator '==' cannot be applied to operands of type 'T' and 'T' .
  </code></pre>
  
  <p>My question is how can I compare two values of T type?</p>