K
Keith Patrick
I am trying to create a typed collection hierarchy (bunch of placeholders
that will eventually be wrappers for generics), but I am having issues with
the inheritance.
CollectionSubclass : Object because of an issue getting
IEnumerable.GetEnumerator() and IDictionary.GetEnumerator() to co-exist
ListBasedCollection : CollectionSubclass, ICollection, IList
UrlCollection : ListBasedCollection
The issue I'm having is coming up with a workable way to have type-specific
implementations of things like .Add(...), etc. Has anyone gotten a
hierarchy like this working, and if so, could you point me to a sample of
it? The main problems I am having is hiding the generic implementation
while being able to expose the specific versions. Main problem right now is
that this doesn't work due to visibility issues:
ListBasedCollection {
IList.Add(Object item) {...}
}
UrlCollectionCollection {
public Add(Url item) {
base.Add(item); // Compiler doesn't see .Add because UrlCollection
and ListBasedCollection are in different namespaces or classes
}
}
that will eventually be wrappers for generics), but I am having issues with
the inheritance.
CollectionSubclass : Object because of an issue getting
IEnumerable.GetEnumerator() and IDictionary.GetEnumerator() to co-exist
ListBasedCollection : CollectionSubclass, ICollection, IList
UrlCollection : ListBasedCollection
The issue I'm having is coming up with a workable way to have type-specific
implementations of things like .Add(...), etc. Has anyone gotten a
hierarchy like this working, and if so, could you point me to a sample of
it? The main problems I am having is hiding the generic implementation
while being able to expose the specific versions. Main problem right now is
that this doesn't work due to visibility issues:
ListBasedCollection {
IList.Add(Object item) {...}
}
UrlCollectionCollection {
public Add(Url item) {
base.Add(item); // Compiler doesn't see .Add because UrlCollection
and ListBasedCollection are in different namespaces or classes
}
}