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 8142315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:46:34+00:00 2026-06-06T12:46:34+00:00

I’m making PriorityQueue<T> classes, and right now I am using List<T> as a backing

  • 0

I’m making PriorityQueue<T> classes, and right now I am using List<T> as a backing store. The following are the errors that I have been getting:

Have Correct Suffix/ Do not have incorrect suffix

Do not expose List<T>

For the -Queue suffix I need to inherit Queue<T>, but to sort a Queue<T>, I would need to empty the queue, sort, and then refill the queue. Also, if I inherit from Queue<T>, I would violate LSP because a priority queue is not a FIFO collection.

For one of the types of PriorityQueues that I am making is using an IComparer<T> to compare the elements, but IComparer<T> is only supported on arrays and List<T>.

I did see this question, but it doesnt fully relate to my question.

So here are my questions:
Should I suppress these code analysis warnings?
Should I inherit from Queue<T> and rewrite my classes to work off of it, even though it is less efficient?
If not, should I still swap out List<T> for something else?

Edit:
I don’t know if this would make any difference, but the following is my setup of each of my classes:

  • PriorityQueue<T> — abstract base class (Sort() is abstract)

  • PriorityQueue<T, TComparer> — subclass that uses a comparer to
    sort

  • ReflectionPriorityQueue<T> — subclass that uses reflection to
    sort, specifics not important to this question.
  • 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-06T12:46:35+00:00Added an answer on June 6, 2026 at 12:46 pm

    These errors have nothing to do with using a List<T> – they’re about the public API.

    Have Correct Suffix/ Do not have incorrect suffix

    This one is debatable – personally, I’d disable this warning, as a PriorityQueue<T> should, in my opinion, use the name PriorityQueue<T>.

    Do not expose List

    This just means you can’t publically expose the List<T> as a List<T>. If you’re encapsulating the list, this should never appear. As long as you keep your list private, this warning should go away.

    Should I inherit from Queue and rewrite my classes to work off of it, even though it is less efficient? If not, should I still swap out List for something else?

    I suspect the problem is that you’re trying to subclass List<T>, which is a bad idea. Encapsulate it as a private member, and implement the appropriate interfaces instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.