I have some generated classes which are similar in form but have no inheritance relationships, like this:
class horse {}
class horses { public horse[] horse {get;}}
class dog {}
class dogs { public dog[] dog {get;}}
class cat {}
class cats { public cat[] cat {get;}}
I want to write a method like:
ProcessAnimals<T>(Object o)
{
find an array property of type T[]
iterate the array
}
So then I might do:
horses horses = ...;
ProcessAnimals<horse>(horses);
It seems like something reflection can be used for but what would that look like?
Aucun commentaire:
Enregistrer un commentaire