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

  • Home
  • SEARCH
  • 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 8894283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:27:25+00:00 2026-06-14T23:27:25+00:00

Could anyone explain me what’s wrong in the following class declaration: private class PriorityQueueEntry<TPriorityValue,IIdentifiableEntry,IType>

  • 0

Could anyone explain me what’s wrong in the following class declaration:

private class PriorityQueueEntry<TPriorityValue,IIdentifiableEntry,IType> :
        IComparer<PriorityQueueEntry<TPriorityValue,IIdentifiableEntry,IType>>
            where TPriorityValue : IComparable
            where IIdentifiableEntry : Identifier<IType>
    {
        public TPriorityValue Priority{get;private set;}
        public IIdentifiableEntry Entry{get;private set;}

        public PriorityQueueEntry(TPriorityValue val,IIdentifiableEntry entry)
        {
            Priority = val;
            Entry = entry;
        }
        public int Compare(PriorityQueueEntry<TPriorityValue,IIdentifiableEntry,IType> first, PriorityQueueEntry<TPriorityValue,IIdentifiableEntry,IType> second) 
        {
            if (first.Priority.CompareTo(second.Priority) < 0)
            {
                return -1;
            }
            else if (first.Priority.CompareTo(second.Priority) > 0)
            {
                return 1;
            }
            return EqualityComparer<IIdentifiableEntry>.Default.Equals( first.Entry.Id, second.Entry.Id);
        }
    }

The compiler complaing on the line where I use EqualityComparer. The error is the following:

error CS0176: Static member `object.Equals(object, object)’ cannot be
accessed with an instance reference, qualify it with a type name
instead

I can’t see where I’m using an instance reference.


Sorry, my fault. I posted an incomplete question.
Just for completeness, Idetifier class is just the following:

public interface Identifier<ID_TYPE> 
{
    ID_TYPE Id{get;set;}
}

using EqualityComparer there, was due to a copy and paste mistake(sorry guys, too much generic code today).

Of course my question was misposed, because I didn’t give you all the elements you needed to answer (I’ll remove it soon).
I needed IType to be IConvertible.
Thanks to all anyway.

  • 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-06-14T23:27:26+00:00Added an answer on June 14, 2026 at 11:27 pm

    Finally I solved this way:

    private class PriorityQueueEntry<TPriorityValue,IIdentifiableEntry,IType> :
            IComparer<PriorityQueueEntry<TPriorityValue,IIdentifiableEntry,IType>>
                where TPriorityValue : IComparable
                where IIdentifiableEntry : Identifier<IType>
                where IType : IConvertible
        {
            public TPriorityValue Priority{get;private set;}
            public IIdentifiableEntry Entry{get;private set;}
    
            public PriorityQueueEntry(TPriorityValue val,IIdentifiableEntry entry)
            {
                Priority = val;
                Entry = entry;
            }
            public int Compare(PriorityQueueEntry<TPriorityValue,IIdentifiableEntry,IType> first, PriorityQueueEntry<TPriorityValue,IIdentifiableEntry,IType> second) 
            {
                if (first.Priority.CompareTo(second.Priority) < 0)
                {
                    return -1;
                }
                else if (first.Priority.CompareTo(second.Priority) > 0)
                {
                    return 1;
                }
                return first.Entry.Id.ToUInt32(NumberFormatInfo.CurrentInfo) < first.Entry.Id.ToUInt32(NumberFormatInfo.CurrentInfo) ? -1:1; 
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could anyone please explain the following line of code, found on http://docs.openttd.org/ai__cargo_8cpp_source.html return (AICargo::TownEffect)::CargoSpec::Get(cargo_type)->town_effect;
Could anyone explain the following line please? RewriteRule ^(.*)$ /index.php/$1 [L]
could anyone explain what the following line of code does /bin/kill -HUP `cat /var/run/syslogd.pid
Could anyone explain me the declaration of the setw manipulator? I was completely blown
Could anyone explain the following two lines please? RewriteEngine on RewriteRule ^(.*)-(.*)-(.*)$ index.php?page=$1&id=$2&im=$3 I
Could anyone explain what is going wrong with my html design <div id=container> <div
Could anyone explain why the following crashes with an access violation at 0xFFFFFFFF at
Could anyone explain to me in noob way what the difference is betweeen ImageIcon
Could anyone explain why $property is 'name' outside of the function and null inside?
Possible Duplicate: Could anyone explain these undefined behaviors (i = i++ + ++i ,

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.