Vinod Sebastian – B.Tech, M.Com, PGCBM, PGCPM, PGDBIO

Hi I'm a Web Architect by Profession and an Artist by nature. I love empowering People, aligning to Processes and delivering Projects.

Advertisements




Reflection in C# Programming

Reflection in C# is a powerful feature that allows developers to inspect and manipulate types, methods, properties, and other members of objects at runtime. It provides a way to obtain metadata about types in the code, such as class hierarchies, interfaces implemented, methods available, and more.

Key Points about Reflection:

  • Enables us to get information about objects at runtime.
  • Using GetField(varName, BindingFlags.XXX | BindingFlags.YYY) allows accessing fields of a class through reflection.
  • Methods like SetValue(null, newInt) and GetValue(null) help in setting and getting values dynamically.
  • Classes like Typeof and System.Type provide information about types, while methods like IsAbstract, IsClass, GetConstructors(), and GetMethods() allow further exploration of classes and methods.
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x