C# Reflection

C# Code Snippets Reflection


In this code snippet, we will take a look at reflection in C#.

Reflection is used to get metadata(information) about an object at runtime. We can get members(propertiesmethods) of objects and their data types. Reflection is also used for late binding. The ability to see the metadata of an object is for example, useful is when you use generics, as you don’t necessarily know the data type of a generic member until the object is created.

Let’s look at the code example below to see how reflection is used.


[amp-gist id=”99fb77a450b204d6f79b158550cdaf92″]

Resulting output:


Leave a Reply

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.
The following GDPR rules must be read and accepted:
This form collects your name, email and content so that we can keep track of the comments placed on the website. For more info check our privacy policy where you will get more info on where, how and why we store your data.

Advertisment ad adsense adlogger