In 3 minutes, What is Reflection?

前端 未结 12 1191
广开言路
广开言路 2020-12-02 10:33

Many .Net interview question lists (including the good ones) contain the question: \"What is Reflection?\". I was recently asked to answer this in the context of a 5 questio

12条回答
  •  天涯浪人
    2020-12-02 11:22

    During compilation of a .Net language, the compiler puts information about the program into the program file. This information can be used by the program itself or by other programs to find out which classes the program contains, what their methods, properties, fields and events are. Classes and their methods, properties and so on can also be used through reflection, even if the other program knows nothing about them before running. This allows different programs to be loosely coupled and makes all sorts of exciting programming possible. Reflection can also be used to build additional classes in running programs or in program files.

提交回复
热议问题