Is it possible to create a List or IEnumerable with GetType ().
// If T is Type of Contact I want to Return List<Contact> Test(typeof(Contact));//return List<Type> public static IEnumerable<T> Test<T>(T t) { return new List<T>(); //return List<Type> }
public static IList GetList(Type type) { return (IList) Activator.CreateInstance(typeof(List<>).MakeGenericType(type)); }
Source: https://habr.com/ru/post/1759038/More articles:Ruby markup parser for custom markup language - ruby | fooobar.comPostgresql Named Windows - sqlПрограммно задайте параметр "Страницы на лист" (N-Up) при печати в Windows - c++Is it possible to connect a dll in memory to prevent unloading? - c ++PrintPage PrintPageEventHandler prints too many copies - c #