title: Using the ConcurrentBag type as a thread-safe substitute for a List
body: <p>In genereal, would using the <code>ConcurrentBag</code> type be an acceptable thread-safe substitute for a <code>List</code>? I have read some answers on here that have suggested the use of <code>ConcurrentBag</code> when one was having a problem with thread safety with generic Lists in C#.</p>
  
  <p>After reading a bit about <code>ConcurrentBag</code>, however, it seems performing a lot of searches and looping through the collection does not match with its intended usage. It seems to mostly be intended to solve producer/consumer problems, where jobs are being (some-what randomly) added and removed from the collection.</p>
  
  <p>This is an example of the type of (<code>IEnumerable</code>) operations I want to use with the <code>ConcurrentBag</code>:</p>
  
  <pre><code>...
  private readonly ConcurrentBag&lt;Person&gt; people = new ConcurrentBag&lt;Person&gt;();
  
  public void AddPerson(Person person)
  {
     people.Add(person);
  }
  
  public Person GetPersonWithName(string name)
  {
     return people.Where(x =&gt; name.Equals(x.Name)).FirstOrDefault();
  }
  ...
  </code></pre>
  
  <p>Would this cause performance concerns, and is it even a correct way to use a <code>ConcurrentBag</code> collection?</p>