O'Reilly logo

A Programmer's Guide to .NET by Alexei Fedorov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.4. Type class and Reflection namespace

The Type class is our entry point into the Reflection namespace and its members. Reflection, in .NET terms, is the ability to examine the capabilities of classes at runtime. By using Reflection, we can take a class and examine its methods, properties, constructors, fields, events, and other members – that is, the metadata associated with a class.

The Type class contains methods such as GetMethods and GetProperties that are used to return member information. By using the classes inside the Reflection namespace, we can go deeper and examine, for example, parameters of the methods (using System.Reflection.MethodInfo class) and even call methods via the Invoke method.

The following example can be used as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required