C# generic method rejecting a type even though it implements required interface?

The generic method does not include the generic type identifier T where T : IEquatable, IComparable should be where T : IEquatable, IComparable.

The generic method does not include the generic type identifier, T. Where T : IEquatable, IComparable should be where T : IEquatable, IComparable.

Aha! You are right! Many thanks.

– Glinkot May 10 at 3:34.

Hopefully I've described it correctly. I have a 'generic method' which looks like the below. It accepts a list of any Icomparable/Iequatable type and returns a class 'compareResult' shown below containing lists of matched/unmatched items.

I now try to pass in a list of 'LicencedCustomer' which is defined as below, and implements the CompareTo and Equals methods to implement the IComparable/IEquatable interfaces. But it says "Error 1 The type 'MFTests. LicencedCustomer' cannot be used as type parameter 'T' in the generic type or method 'MF.Comparers.

There is no implicit reference conversion from 'MFTests. LicencedCustomer' to 'System. I thought I had implemented IComparable though it refers to conversion which I don't really understand.

Sorry for the long explanation, I tried to keep it as brief as possible. Any thoughts on what I'm doing wrong?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions