Software Architecture – C# 4.0 – New Feature – Synchronized Data Structures – Thread Safe Queue

In c# 4.0, Microsoft has introduced a new namespace with name “System.Collections.Concurrent” which provide set of collections having thread safe behavior.

Some of these thread safe collections are as:

ConcurrentDictionary<TKey, TValue>

 Lets take example of example of Queue data structure, Simple queue is explained here

The generic version of queue is explained here.

Before arrival of C# 4.0, thread safety in queue was ensured by using Queue.Synchronized as explained at:

But now we have better implementation of thread safe queue with System.Collections.Concurrent namespace, as explained here:


6 Responses to Software Architecture – C# 4.0 – New Feature – Synchronized Data Structures – Thread Safe Queue

  1. Peter Gfader says:

    These new types rock!

    Did you already use them in a project?


  2. shahzadsb says:

    This namespace is really good addition to .net family.

    Yes, in all the new projects. We heavy insist developers to use them.

    Saw your blog… interesting stuff.


  3. Peter Gfader says:


    What I love about this new Concurrent types is that
    #1 Code is much easier to write without locks in place
    #2 Readability is so much better without locks

  4. Dobeoblilla says:

    Hi, it’s nice here so I am just saying hi. I’ve been reading forums for a month now and decided to register. Hope that my english will be good enough to communicate with you :). My hobby are airplanes and my hobby page – – bilety lotnicze it’s about them.

  5. fungusnails says:

    פטרת הינה בעיה נפוצה במיוחד בקרב האוכלוסיה ולי יש המלצה לפתרון:
    חדשנות בטיפול בפטרת ציפורניים
    הריגת פטרת השוכנת מתחת לציפורניים,
    בשנים האחרונות התפתח תחום הטיפול בפטרת ציפורניים.
    שיטה חדשנית תעזור לכם
    בחיסול הפטריות
    אני ממליצה בחום על פטרת קליניק כמרפאה המובילה לחיסול פטרת ציפורניים בלייזר.
    ביטחון מלא בהצלחת הטיפול!
    ניתן לזהות בכמה דרכים מתי אדם סובל מפטרת
    סירחון, שינוי צבע הציפורן לגוון צהוב או סגול.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: