Reflection and Generic Types
From the point of view of reflection, the difference between a generic type and an ordinary type is that a generic type has associated with it a set of type parameters (if it is a generic type definition) or type arguments (if it is a constructed type). A generic method differs from an ordinary method in the same way.
The problem in reflection is to provide a way to examine this array of type parameters or type arguments. In the case of type parameters, reflection must also provide a way of examining the constraints. This section describes the methods of the Type and MethodInfo classes that provide the ability to examine generic types and methods.
In This Section
Overview of Reflection and Generics
Explains the two key things you need to know to understand reflection over generic types and methods, and introduces the most important properties and methods that unlock generics.How to: Examine and Instantiate Generic Types with Reflection
Shows how to use the properties and methods of Type and MethodInfo to examine generic types.
Reference
Type.IsGenericType
Provides a table of invariants for the terms used to discuss generic types and methods.MethodInfo.IsGenericMethod
Provides a table of invariants for the terms used to discuss generic methods
Related Sections
Overview of Generics in the .NET Framework
Describes the generics feature and introduces terminology for talking about generics.How to: Define a Generic Type with Reflection Emit
Shows how to use reflection emit to generate generic types in dynamic assemblies.Viewing Type Information
Describes the Type class and provides code examples that illustrate how to use Type with various reflection classes to obtain information about constructors, methods, fields, properties, and events.