public delegate int Method(T obj); public int AnyMethod(Method CompareTo) { T obj1, obj2; //... return obj1.CompareTo(obj2) } 

Error CS1061 "T" does not contain the definition of "CompareTo", and it was not possible to find an available extension method "CompareTo" that takes the type "T" as the first argument (it is possible that the using directive or the link to the assembly is missing).

How to delegate correctly in this case?

  • @AlexKrass, there is no typo in the error message. - Qwertiy
  • @Qwertiy, I saw a typo in the code, I didn’t get into the error text - Alex Krass

1 answer 1

 public delegate int Method<T>(T obj) where T : IComparable;