I am looking at Skeet's AtomicEnumerable but I'm not sure how to integrate it into my current IEnumerable exmaple below (http://msmvps.com/blogs/jon_skeet/archive/2009/10/23/iterating-atomically.aspx)
Basically I want to foreach my blahs type in a thread-safe way.
thanks
so .. foreach on multiple threads ... giving correct order
Blahs b = new Blahs();
foreach (string s in b) { }
public sealed class Blahs : IEnumerable<string>
{
private readonly IList<string> _data = new List<string>() { "blah1", "blah2", "blah3" };
public IEnumerator<string> GetEnumerator()
{
return _data.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}