Thursday, 8 August 2013

Method for convert generic list to another generic list

Method for convert generic list to another generic list

I have Data In List and want to convert into List. my code is as
public static List<T> ListCopy<T>(List<T> input)
{
List<T> mylist = new List<T>();
//Logic Goes here
return mylist;
}
this only copy data from List to List but i want to use this like
List<One> l = new List<One>();
List<Two> t = new List<Two>();
t = ListConvert<Two>(l);
what can i do for this?

No comments:

Post a Comment