iterating over collection
Peter Osucha <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <[email protected]> |
I have an abstract base object. I have several classes that are derived from the base object. I have several collection classes (one for each of the derived classes) that internally use Dictionary<> objects - but of course the generic collections use derived objects even though all the derived objects are derived from the base object. I have several (one for each collection class) methods into which I pass a collection class instance and which then look for a specific object in the collection based on a property that comes from the base object. Is there a way (I can't figure one out and don't know if it's possible since the collection classes are all of specific object types) to somehow have one method into which I could pass any of the collection classes (since the are all based on the Dictionary<> object though with different generic objects even though all based on the abstract base object) and then somehow loop over them after casting to the base object type? It seems there *ought* to be a way even if I have to do some minor rework on the derived objects or the collection objects. I hope this made some sense. Peter =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com