Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
C# では、オープン ジェネリック型を簡単に作成できますtypeof(IEnumerable<>)。オープン ジェネリックを含む型を作成する方法はありますか? 以下は機能しません: typeof(IEnumerable<IFoo<>>).
typeof(IEnumerable<>)
typeof(IEnumerable<IFoo<>>)
方法はありません。これらはジェネリックではありませんが、バインドされていない型です。これらは特別な型であり、インスタンス化することはできません。バインドされていないジェネリック型は、直接の typeof-expression 内でのみ使用できます。
使用するtypeof(IEnumerable<IFoo<>>)場合、typeof式ではなく式で非バインド型を使用していIEnumerable<T>ます。
IEnumerable<T>