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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:50:28+00:00 2026-06-16T19:50:28+00:00

System.Collections.Queue class has Queue.Synchronized method which returns a thread-safe Queue implementation. But the generic

  • 0

System.Collections.Queue class has Queue.Synchronized method which returns a thread-safe Queue implementation.

But the generic one, System.Collections.Generic.Queue does not have a Synchronized method. At this point I have two questions in mind:

  1. Why doesn’t generic one have this method? Is it a framework API design decision?
  2. How is the queue returned from Queue.Synchronized is different than ConcurrentQueue<T> class?

Thanks.

  • 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-16T19:50:29+00:00Added an answer on June 16, 2026 at 7:50 pm

    The Synchronized() method returns a wrapper queue that slaps a lock around every method.
    This pattern is not actually useful when writing multi-threaded applications.

    Most real-world use patterns will not benefit for a synchronized collections; they will still need locks around higher-level operations.

    Therefore, the Synchronized() methods in System.Collections are actually a trap that lead people into writing non-thread-safe code.


    The ConcurrentQueue<T> class is specifically designed for concurrent applications and contains useful methods that atomically modify the queue.

    The concurrent collections package only contain methods that make sense to use in a multi-threaded environment (eg, TryDequeue()); they will help guide you to write code that is actually thread-safe.

    This is called the pit of success.

    For much more information, see my blog

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

Sidebar

Related Questions

I'm creating a class named TetraQueue that inherits System.Collections.Generic.Queue class overriding the Dequeue method,
I have generic Queue<T> ( System.Collections.Generic ) which is accessed for writing from one
I am using a System.Collections.Generic , which contains instances of a class I wrote.
Is System.Collections.Generic.List<T> a type of linked list (not the LinkedList<T> class) ? A linked
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace EfTestFactory { public abstract class
I have the following class: using System; using System.Collections; using System.Collections.Generic; using System.Data; using
I have a Windows Service that uses System.Collections.Generic.Queue to keep some files that I'll
I'm trying to access System.Collections.Generic.Stack<> in Visual C# 2010 Express, but the IDE (and
I have a stream of data which is contained in a System::Collections::Queue . My
I have a system.collections.generic.list(of ListBox) I would like to use the collection classes built-in

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.