Hi,
A collection is by default not thread safe, if you are enumerating a
collection you cannot add an element to it, it would rise an exception.
Take a look at skeet's singleton implementation to know how to do a thread
safe singleton class.
Of course this has nothing to do with making the collection operations
threadsafe. You have to do this by your own using some locking mechanism.
I would not implement the IBindingList , what I would do in this case is
implement an event in your collection that is risen when a new element is
added to the collection, doing so will allow you to do whatever you want on
the interface.
The form hangs probably cause the worker thread is not done yet.
Hope this help

Signature
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
> Hi
>
[quoted text clipped - 14 lines]
>
> Torben
Torben Frandsen - 04 Aug 2004 12:58 GMT
Ignacio Machin ( .NET/ C# MVP ) wrote:
> A collection is by default not thread safe
I figured as much :-)
> Of course this has nothing to do with making the collection operations
> threadsafe. You have to do this by your own using some locking
> mechanism.
So what you mean is, it's not sufficient to take out a lock whenever an
instance is requested? When else should I take out a lock? When I request an
item? When I change an item? Everywhere?
> I would not implement the IBindingList , what I would do in this
> case is implement an event in your collection that is risen when a
> new element is added to the collection, doing so will allow you to do
> whatever you want on the interface.
And in the end I might have to do that. I just wouldn't have thought my
approach was so unusual.
Torben