Hey all,
It's kind of difficult to explain what I am looking to do, and it might
seem a little wacky, but here goes a simplified version of the question....
I've got some lists of data in a database which I have a GenericList
interface for (from the database), so no matter what type of data is in
the DB, it has a way of displaying it as a GenericList.
Each bit of data can be loaded into a data cache by using:
public void loadData<T>(vars) where T : GenericList
To load lots of data at once I would do this
void someMethod()
{
ClassType vars = new ClassType();
loadData<Name.Space.Settings>(vars); // load settings
loadData<Name.Space2.CatPictures>(vars); // load cat pictures
loadData<Name.Space2.OtherMemes>(vars); // load other memes
}
What I am wondering if I can do something like this: (obviously the code
below isn't valid, but it should illustrate what I am trying to do)
void someMethod()
{
Type[] typeArray = new type[]{ Name.Space.Settings,
Name.Space2.catPictures, Name.Space2.otherMemes };
ClassType vars = new ClassType();
for (int i = 0; i < typeArray.length; i++)
{
loadData<typeArray[i]>(vars); // load each one of those types
}
}
-------------------------------------------------
Any ideas? Thanks heaps :)
--
Les Hughes
[email protected]