[Mono-devel-list] [PATCH] System.Collections.ObjectModel implementations

David Waite dwaite at gmail.com
Tue Jun 21 02:29:19 EDT 2005


Ben mentioned a strong desire to duplicate the microsoft behavior
here, although I gave him the option. I have a test case (factored
from my experimentation code on ms.net) that checks the return type
from SyncRoot - when passed an object that implements ICollection, it
returns that object's SyncRoot, otherwise it returns System.Object -
which I assume is just a locking object instance.

-David Waite

On 6/21/05, Raja R Harinath <rharinath at novell.com> wrote:
> Hi,
> 
> Ben Maurer <bmaurer at ximian.com> writes:
> 
> > On Mon, 2005-06-20 at 00:44 -0600, David Waite wrote:
> >> Included in this patch are implementations of Collection<T> and
> >> ReadOnlyCollection<T>. KeyedCollection I left alone.
> >>
> >> 2005-06-19  David Waite  <mass at akuma.org>
> >>
> >>         * Collection.cs ReadonlyCollection.cs: Implement all methods
> >> _______________________________________________
> >
> >
> >
> >> -                       throw new NotImplementedException ();
> >> +                       if (list == null)
> >> +                               throw new ArgumentNullException("list");
> >> +                       this.list = list;
> >> +                       ICollection l = list as ICollection;
> >> +                       syncRoot = (l != null) ? l.SyncRoot : new object();
> >>                 }
> >
> > Is the syncroot behavior exactly what msft does? Do you have tests?
> > (ditto for readonly version).
> 
> According to msdn2.microsoft.com, SyncRoot returns the current object by
> default (whatever that means :-)
> 
> - Hari
>



More information about the Mono-devel-list mailing list