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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:59:08+00:00 2026-05-20T17:59:08+00:00

I just saw an SO question about the System.Collections.ConcurrentBag<T> class, and I’ve seen the

  • 0

I just saw an SO question about the System.Collections.ConcurrentBag<T> class, and I’ve seen the ViewBag property of the Controller in ASP.NET MVC. In my experience, I’ve learned that it’s easier to use people’s code if you understand what exactly they were getting at in writing it. I think its pretty intuitive as to what a List<T> or a Dictionary<TKey,TValue> or a ReadOnlyCollection<T> are meant to represent. A Bag on the other hand is not so intuitive.

So, my question is: What is this Bag metaphor meant to represent, specifically with respect to the .NET framework?

  • 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-20T17:59:08+00:00Added an answer on May 20, 2026 at 5:59 pm

    ConcurrentBag<T> is a thread-safe, unordered sequence of items which can include duplicates.

    So compared with some other collections:

    • It’s unordered, like a HashSet<T> but unlike a List<T>
    • It can contain duplicates, like a List<T> but unlike a HashSet<T>
    • It’s just values rather than a map (unlike Dictionary<TKey, TValue>)
    • It’s thread-safe, unlike all the non-concurrent collections – so you can share an instance between multiple threads, all reading and writing.

    Possible uses include a work queue where you don’t care about the ordering (as otherwise you’d use ConcurrentQueue / ConcurrentStack) or a list of items where you’ll always apply a sort order after fetching the data into another “local” collection.

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

Sidebar

Related Questions

I just saw this dating site on builtwithbootstrap and have a question about table
I'm just starting to get into ASP.NET MVC, and saw today that the Beta
I just saw this video http://www.youtube.com/watch?v=y71lli8MS8s and find it amazing. The question is about
Just saw this question relating to a segmentation fault issue in a C++ class
Have just started converting an existing job tracking system into an ASP.NET MVC application.
I just saw this question and one of the answers looks really appealing to
I know this may seem like a math question but i just saw this
I have a question about linked lists in java. I saw an interesting approach
I saw there is an answered question about whether there is a difference between
I saw this question asked about C# I would like an answer for PHP.

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.