Reflection in C#

Page 1 of 2
  1. Introduction
  2. An Example

Introduction

The ability to find out information about objects at run-time is called Reflection. In Reflection we can find out the object’s class, details of an object’s methods, and even create one dynamically at runtime. Reflection is a powerful mechanism with the System.Reflection namespace contains nearly forty classes and interface. The Type class is the root of all reflection operations and the Object that represents a type inside the system. Type is an abstract base class that allows multiple implementations.

This class is the primary means by which we can access metadata, and it acts as a gateway to the Reflection API. It provides methods for obtaining information about a type declaration, such as the constructors, methods, fields, properties, and events of a class, as well as the module and the assembly in which the class is deployed.

You might also like...

Comments

About the author

Kamran Shakil Pakistan

I am 22 male. BS(Computer Science), MCSE, Brainbench certifed. Member of .NET Open source, Mono Project. E-author on various websites, including www.dotnetextreme.com, www.csharphelp.com and so...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.” - Donald Knuth