Reflection allows the application to collect information about itself, as well as manipulate itself. It can be used to search for all types in an assembly and / or dynamically call methods in an assembly.
System.Reflection: the namespace contains classes and interfaces that provide a controlled representation of loaded types, methods and fields with the ability to dynamically create and call types; this process is known as reflection in the .NET framework.
The System.Type: class is the main class for .NET Reflection functions and is the main way to access metadata. The System.Type class is an abstract class and is a type in the Common Type System (CLS).
It presents type declarations: class types, interface types, array types, value types, enumeration types, type parameters, generic type definitions, and open or closed constructed generic types.
For example:
using System; using System.Reflection; static class ReflectionTest { public static int Height; public static int Width; public static int Weight; public static string Name; public static void Write() { Type type = typeof(ReflectionTest);
SHEKHAR SHETE May 29 '12 at 7:41 am 2012-05-29 07:41
source share