Hi,

Lets say I have a function,which accepts as a parameter a string.

Depending on the value of this string I would like to return a generic list of different types.

So, for instance:

Lets say I pass in the word,"dogs", well then I´d like to return List<Dogs> mydogList = new List<Dogs>();

If I pass in the word "cars", well the same thing,return List<Cars> myCarlist = new List<Cars>();

My function I had in mind would be something similiar to:
(Please note that the code below is incorrect!)

Code:
Public List<T> MyFunction(String str)
{
switch (str)
case "Dogs":
return  List<dogs> dogsList = new list<dogs>();
Case "Cars":
return List<cars> carList = new list<cars>();
}
But this obviously doesn´t work,...

Could sb please shine some light on how to improve my approach, or take a totally different one?
Thanks !