none
About ConcurrentBag RRS feed

  • Question

  • Hello,

    Based from your experience, what context and why have you applied ConcurrentBag in different c# project in relation to business?

    Thank you!
    Sunday, February 16, 2020 7:13 AM

All replies

  • It's a thread safe collection and is useful in cases where multi-threading is involved and some threads might be adding items to collection and some are using those like Producer/Consumer case.

    We had a scenario where millions o rows were bring loaded in memory by multiple threads and multiple threads reading from concurrent bag.

    you can read more about it at following:

    https://docs.microsoft.com/en-us/dotnet/api/system.collections.concurrent.concurrentbag-1?view=netframework-4.8

    http://dotnetpattern.com/csharp-concurrentbag


    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered"Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]


    Blog | LinkedIn | Stack Overflow | Facebook
    profile for Ehsan Sajjad on Stack Exchange, a network of free, community-driven Q&A sites



    Sunday, February 16, 2020 10:00 AM
  • This sounds like a question on an employment interview.  If so, it is HIGHLY unethical for you to ask for assistance in answering it.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Sunday, February 16, 2020 7:41 PM
  • Agreed.

    If you've never used it before in real life application, just say "no". When the interviewer later as you detail about it and found you faked it (trust me, lots of companies ask this kind of question "Based from your experience, what context and why have you applied <some technology> in different c# project in relation to business?" to get insight on how other companies are using it, since most tutorial sites for those technologies will just status the "plus" side without telling you what could possibly go wrong), it's worse than you directly admit you've never used it, because that means any information you supplied in your resume could also be fake.

    Monday, February 17, 2020 5:48 AM
    Answerer