Reflection in C sharp Arabic #52
Suggested Videos
❑ The basics of reflection.
❑ Understand the uses of reflection.
Reflection
Reflection is the ability of inspecting an assemblies metadata at runtime.it is used to fid all types in an assembly and/or dynamically invoke methods in an assembly.
Uses of reflection:
1-when you drag and drop a button on a win forms or an asp.ent application. The properties window uses reflection to show all the properties of the Button class. So, reflection is extensively by IDE or UI Designers.
2-late binding can be achieved by using reflection. You can use reflection to dynamically create an instance of a type , about which we don’t have any information at compile time. So, reflection enables you to use code that is not available at compile Time.
3-consider an example where we have two alternate implementations of an interface. You want to allow the user to pick one or the other using a config file. With Reflection, you can simply read the name of the class whose implementation you want to use from the config file , and instantiate an instance of that class .this is another example for late binding using reflection .
Tags:
C sharp