System.Reflection.TypeInfo Class

Represents type declarations for class types, interface types, array types, value types, enumeration types, type parameters, generic type definitions, and open or closed constructed generic types.

See Also: TypeInfo Members

Syntax

public abstract class TypeInfo : Type, IReflectableType

Remarks

Starting with the net_v45, the System.Reflection.TypeInfo class is included in the net_win8_profile subset for use in creating Windows Store apps. System.Reflection.TypeInfo is available in the full .NET Framework as well. For more information about reflection for Windows Store apps, see tp://msdn.microsoft.com/library/windows/apps/hh441595(v=vs.110) in the Windows Dev Center and Reflection in the .NET Framework for Windows Store Apps in the MSDN Library.

System.Reflection.TypeInfo contains many of the members available in the Type class, and many of the reflection properties in the net_win8_profile return collections of System.Reflection.TypeInfo objects. To get a System.Reflection.TypeInfo object from a Type object, use the IReflectableType.GetTypeInfo method.

A System.Reflection.TypeInfo object represents the type definition itself, whereas a Type object represents a reference to the type definition. Getting a System.Reflection.TypeInfo object forces the assembly that contains that type to load. In comparison, you can manipulate Type objects without necessarily requiring the runtime to load the assembly they reference.

In the net_win8_profile, you use the reflection properties of System.Reflection.TypeInfo that return IEnumerable`1 collections instead of methods that return arrays. For example, use the TypeInfo.DeclaredMembers property to get all declared members, or the TypeInfo.DeclaredProperties property to get all declared properties. Reflection contexts can implement lazy traversal of these collections for large assemblies or types. To get specific members, use methods such as TypeInfo.GetDeclaredMethod(string) and TypeInfo.GetDeclaredProperty(string), and pass the name of the method or property you would like to retrieve.

To filter the results of System.Reflection.TypeInfo properties, use LINQ queries. For reflection objects that originate with the runtime (for example, as the result of typeof(Object)), you can traverse the inheritance tree by using the methods in the System.Reflection.RuntimeReflectionExtensions class. Consumers of objects from customized reflection contexts cannot use these methods and must traverse the inheritance tree themselves.

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0