Something like this should work.
public IList createList(Type myType)
{
Type genericListType = typeof(List<>).MakeGenericType(myType);
return (IList)Activator.CreateInstance(genericListType);
}
More Related Contents:
- Find index of returned list result C#
- Difference between List and array when initiating [closed]
- How to split Fromdate and Todate based on weekdays(Sat,Sun) using linq c#
- IEnumerable vs List – What to Use? How do they work?
- What is the best way to modify a list in a ‘foreach’ loop?
- How to create List of open generic type of class?
- How create a new deep copy (clone) of a List?
- How to get values of selected items in CheckBoxList with foreach in ASP.NET C#?
- Adding items to a LIST of objects results in duplicate Objects when using a NEW in a Loop
- C# List to string with delimiter
- Combination of List
- Getting all file names from a folder using C# [duplicate]
- Check if a string contains an element from a list (of strings)
- How can I list the contents of a .zip folder in c#?
- c# When should I use List and when should I use arraylist?
- How to remove item from list in C#?
- Convert rows from a data reader into typed results
- Can Newtonsoft Json.NET skip serializing empty lists?
- Case-Insensitive List Search
- LINQ to find series of consecutive numbers
- convert List to IList
- List size limitation in C#
- IEnumerable vs IReadonlyCollection vs ReadonlyCollection for exposing a list member
- Binding Listbox to List in WinForms
- Get a list of distinct values in List
- How to sort a list / array of string version number?
- How do I get the list of keys in a Dictionary?
- C# Convert List to Dictionary
- Multi-dimensional arraylist or list in C#?
- readonly keyword does not make a List ReadOnly?