In C# it is easy to create an open generic type, typeof(IEnumerable<>)
. Is there a way to create a type that contains an open generic? The following does not work: typeof(IEnumerable<IFoo<>>)
.
Get the two unbound generic types involved, and then use one as the argument to making a generic type from the other:
typeof(IEnumerable<>).MakeGenericType(typeof(IFoo<>))