4.2.2 IReadOnlyCollection is not implemented in NameValueListBase

4.2.2 IReadOnlyCollection is not implemented in NameValueListBase

Old forum URL: forums.lhotka.net/forums/t/11053.aspx


ynijsen posted on Friday, January 13, 2012

in my factory classes I wan't to differentiatie between Editable Collections and Read Only collections. I suppose this is where IReadOnlyCollection is for. 

But NameValueListBase doesn't implement this (empty) interface.
It does inherit from ReadOnlyBindingList, just as ReadOnlyListBase does. And that has a IReadOnlyCollection interface.

The need for this is for the type constraint in the generic class that would allow only ReadOnlyListBase and NameValueListBase implementations:

Like in:

 

 internal abstract class ReadOnlyListFactoryBase<TList, C> : FactoryBase<TList, C>
        where TList : IReadOnlyCollection IBusinessObject
        where C : DAL.Core.IDataItem<C>, new()
{...}

Copyright (c) Marimer LLC