If you are using .Net 4, then using dynamic may help. In this case, you can use methods in the instance that are not accessible through non-common interfaces (for example, IList ).
For example, using dynamic allows you to call the AddRanges method of a list, which you could not do using IList translation:
Type _type = typeof(int); Type listType = typeof(List<>).MakeGenericType(_type); dynamic list = Activator.CreateInstance(listType); list.Add(1); list.AddRange(new int[] {0, 1, 2, 3});
However, this method is not as similar to a type as pointing to a non-generic interface, because it cannot catch errors at compile time.
source share