Understanding Reflection

I recently started working for a new company, and the .net web application we created is built using reflection. I just did not study for a year and did not work with this concept. After learning the code ... it looks like there is one interface with the base interface of an object of type that has about 20 classes that inherit it. many generic sets and sets

At first glance, this looks like standard inheritance. I think my question is what makes this reflection? Is it because the interface is not very typed?

thanks

+6
reflection c # web-applications interface
source share
4 answers

Read about Reflection on Wikipedia. Then check the reflection namespace on MSDN.

I believe that I know the big picture that you are facing. The need for reflection arises when the user can specify the type and member names at run time. Then, the program needs to use reflection to match incoming names with actual type members.

Generally speaking, if your program checks the types of objects at runtime, then you use reflection.

BTW, Strengths and Weaknesses are attributes of a language type system, but not of any application or structure (for example, an interface, etc.) written in this language. i.e. "C # is considered by many typed languages."

+9
source share

Who says it is “built using reflection”? Your colleagues

Generally speaking, use reflection tools to check or generate code at runtime.

If an application uses reflection, it probably uses material from the System.Reflection namespace, so to understand the extent to which reflection is used, you can remove references to that namespace and see what happens ...

+1
source share

"Reflection: the ability to detect a composition of a type (eg, class, interface, structure, enumeration or delegate) at runtime."

I believe that your colleagues refer to how they create objects. I am sure your objects are built using standard inheritance.

0
source share

a) An application cannot be built using reflection. Reflection is most likely part of the application. As well as inheritance in the case of one parent and 20 children's classes, as you mention.

b) Reflection is used to analyze the object at run time. Assuming you have a reference to an object of an object of type, and perhaps this type of object can change, and you want properties to be displayed at runtime, and then reflection. Another case is when you need to call a method, but you really don’t know which method and its general.

c), since his .net application, in the case of vb.net, has a line with something like objectinstance. GetType .somemethod wil points to reflection. check it out

0
source share

All Articles