Reflection and Generics
In .NET Framework 2.0, Reflection was extended to accommodate open and closed generic types and methods. The Type class is the focal point of changes that extend reflection to accommodate generic types, while MethodInfo has been enhanced to reflect generic methods. (Generics were introduced in Chapter 7.) Open constructed types are generic types with unbound type parameters, whereas closed constructed types have bound type arguments. With Reflection, you can browse bound and unbound parameters, create instances of generic types, and invoke generic methods at run time.
IsGeneric and IsGenericTypeDefinition
With reflection, you can query the status of a type or method. Is a type or method generic? If generic, is the type or ...
Get Programming Microsoft® Visual C#® 2008: The Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.