It is abstract, so if it has a constructor then it is proteted...
Basically, unless you provide your own concrete implementation of
this, you can't use it. The only concrete subclass (that I can see) is
System.ServiceModel.UriSchemeKeyedCollection.
Of course, I *still* don't believe they gain much ;-p
Marc
> It is abstract, so if it has a constructor then it is proteted...
>
[quoted text clipped - 5 lines]
>
> Marc
Ahh, your right. When I read "SychronizedCollection<T>" I thought it
would autolock at the lower levels to ensure no crashing and the such
(Good for quick, simple use of a thread safe collection). But now
when I read it again on MSDN "The SynchronizedCollection<(Of <(T>)>)
stores data in a List<(Of <(T>)>) container and provides an object
that can be set and used to synchronize access to the collection so
that it is thread-safe.". This means I have to lock manually (just
like I would with List<T>) before using it? Basically Identical to a
List<T> excpet it has a SyncLock object built inside?
That is almost useless, if I'm understanding it right :) If I'm
mistaken (and the collection does auto lock at lower levels), please
correct me :)
NB
Marc Gravell - 22 Feb 2008 19:45 GMT
> Ahh, your right. When I read "SychronizedCollection<T>" I thought it
> would autolock at the lower levels to ensure no crashing and the such
It appears to lock for individual operations; but *generally* in my
experience you need to consider multiple operations as a transaction
for it to be useful (whether that is the duration of a foreach, or a
"contains/add" pair, etc).
But essentially all the methods on this do lock the sync-object -
something like:
public Foo Bar(...) {
lock(SyncRoot) {
return Items.Bar();
}
}
(if you see what I mean)
Marc
NvrBst - 22 Feb 2008 19:50 GMT
> > Ahh, your right. When I read "SychronizedCollection<T>" I thought it
> > would autolock at the lower levels to ensure no crashing and the such
[quoted text clipped - 17 lines]
>
> Marc
Ahh, it has its uses then! :) Thanks for the update, and all the
help ya've given.
NB