Dave

Dave

  • NA
  • 3
  • 0

Derived Classes

Mar 15 2009 9:55 AM

New to the site, and C#, and the site has been a great help.  I have been experimenting with the 'An Elegant C# Data Access Layer using the Template Pattern and Generics' article, hopefully someone can help me with this problem.

I have 3 objects:  ObjectA, ObjectB, ObjectC.  All 3 are derived from an object ParentObject.  Parent Object has a property 'ID'.

If the objects are stored in a Collection like: Collection<ObjectA>, Collection<ObjectB>, Collection<ObjectC>.

Is there any way that I can use Collection<ParentObject> as a parameter to a single function in order to read the 'Id' Property from either of the Collections. 


Answers (2)