---
title: "Reflection in C#.Net"  
description: "Reflection provides objects (of type Type Class) that encapsulate assemblies, modules and types. You can use reflection to dynamically create an insta"  
author: "AVADHESH PATEL"  
published: 2012-07-09  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/960/reflection-in-c-sharp-dot-net  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Reflection in C#.Net

Reflection provides objects (of type Type Class) that encapsulate assemblies, modules and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties. If you are using attributes in your code, Reflection enables you to access them.CLR is an internal reflection that checks the framework version.\

Through reflection

1. I can load assembly dynamically.

2. I can open, browse the assembly.

3. Reflection gets the info like version of assembly. Using manifest we can go for browsing assembly.

4. Access all info of class to base class.

5. Without using header file we can call dll function by reflection (let binding).

6. Through reflection we can add info in a class.

7. Through reflection we can achieve late binding.

##### Example:

How to brows DLL with the help of Reflection?

Step 1: Type below code on **notepad** and save **with info.cs** in drive **D**

![Reflection in C#.Net](https://www.mindstick.com/mindstickarticle/f9a02c36-f33e-4f70-9662-127f4184565f/images/5d5261e7-81ad-482d-81ac-08f9eec1425e.png)

Step 2: Open **Visual studio prompt** and make DLL of **info.cs** file

![Reflection in C#.Net](https://www.mindstick.com/mindstickarticle/f9a02c36-f33e-4f70-9662-127f4184565f/images/e3725178-95fd-40bb-9448-609f3e3c2406.png)

Step 3: Type below code on **notepad** and save **with showinfo.cs** in drive **D**

![Reflection in C#.Net](https://www.mindstick.com/mindstickarticle/f9a02c36-f33e-4f70-9662-127f4184565f/images/109dd9ea-0b67-48dc-afd1-86ab5fe562f6.png)

Step 4: Open **Visual studio prompt** and compile the **showinfo.cs** file

![Reflection in C#.Net](https://www.mindstick.com/mindstickarticle/f9a02c36-f33e-4f70-9662-127f4184565f/images/273cd2cb-6ac9-42d7-aa99-09cfc4846621.png)

Step 5: Execute showinfo.cs file

![Reflection in C#.Net](https://www.mindstick.com/mindstickarticle/f9a02c36-f33e-4f70-9662-127f4184565f/images/ebcc0df6-4c76-4139-ad0e-fdfa44b6edd1.png)

Step 6: we can browse info.dll file via ildasm and check class, function name

![Reflection in C#.Net](https://www.mindstick.com/mindstickarticle/f9a02c36-f33e-4f70-9662-127f4184565f/images/13346f91-662c-41f3-a42b-06a2ca19f1ac.png)

![Reflection in C#.Net](https://www.mindstick.com/mindstickarticle/f9a02c36-f33e-4f70-9662-127f4184565f/images/7a5371e2-1122-4eed-ac0a-eb9eecbb75a3.png)

\

---

Original Source: https://www.mindstick.com/articles/960/reflection-in-c-sharp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
