Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4607592
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:43:29+00:00 2026-05-22T00:43:29+00:00

Hopefully I’ve described it correctly. I have a ‘generic method’ which looks like the

  • 0

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.

public partial class Comparers
{
    public class compareResult<T>
    {
        public List<T> unchangedItems;
        public List<T> changedItems;
        public List<T> leftOrphans;
        public List<T> rightOrphans;
    }

    public static compareResult<T> stepCompare<T>(List<T> leftList, List<T> rightList, bool confirmUniqueIDs = true) where T : IEquatable<T>, IComparable
    {
        ...

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.

public class LicencedCustomer : IEquatable<LicencedCustomer>, IComparable<LicencedCustomer>
    {

        public string LMAA_CODE {get; set;}
    ...

Now I try to pass two lists of customers per below:

Comparers.compareResult<LicencedCustomer> result = new Comparers.compareResult<LicencedCustomer>();

result = Comparers.stepCompare(leftList, rightList);

But it says “Error 1 The type ‘MFTests.LicencedCustomer’ cannot be used as type parameter ‘T’ in the generic type or method ‘MF.Comparers.stepCompare(System.Collections.Generic.List, System.Collections.Generic.List, bool)’. There is no implicit reference conversion from ‘MFTests.LicencedCustomer’ to ‘System.IComparable’…

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:43:30+00:00Added an answer on May 22, 2026 at 12:43 am

    The generic method does not include the generic type identifier, T.

    where T : IEquatable<T>, IComparable
    

    should be

    where T : IEquatable<T>, IComparable<T>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hopefully this will not spark a religious war... We have a web based app
Hopefully an easy question, but I'd quite like a technical answer to this! What's
Hopefully I can make this clear. I have a DataGrid <DataGrid Grid.Row=6 Grid.Column=1 AutoGenerateColumns=False
Hopefully this is an easy one. In my app, I have an event page
Hopefully, I can get answers for each database server. For an outline of how
Hopefully I haven't misunderstood the meaning of duck typing, but from what I've read,
Hopefully I can do the problem justice, because it was too difficult to summarise
Hopefully a picture is worth a thousand lines of code because I don't want
Hopefully this is a simple one, but can anyone provide some simple c# code
Hopefully some Custom Control Designers/Builders can help I'm attempting to build my first custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.