C # My study notes-Reflection

Source: Internet
Author: User
Reflection: Custom Attributes: Implement delayed permission granting for delayed compilation, and dynamically compile metadata to view information in metadata PE files: Metadata is stored in PE files, delayed compilation adds content type to PE files: view various types of data: Methods, attributes, and other information to determine whether it is an int Generic Dynamic build anything: Class, attribute method generic, etc. Program Set contains modules, while the module contains types and types including members. Reflection provides encapsulated assembly, module, and type objects. Use Assembly to define and load an assembly, load the modules listed in the assembly list, locate the type in this Assembly, and create instances of this type. Use module to discover the following information: including the Module assembly and classes in the module. You can also obtain all global methods defined on the module or other specific non-Global methods. Use constructorinfo to find the following information: name, parameter, access modifier (such as public or private) and implementation details (such as abstract or virtual) of the constructorinfo. Use the getconstructors or getconstructor method of type to call a specific constructor. You can use methodinfo to find the following information: method name, return type, parameter, access modifier (such as public or private), and implementation details (such as abstract or virtual. Use the getmethods or getmethod method of type to call a specific method. Use fieldinfo to find the following information: field name, access modifier (such as public or private), implementation details (such as static), and so on; and obtain or set the field value. Use eventinfo to find the following information: event name, event handler data type, custom attribute, declaration type, and reflection type, and add or remove event handlers. Use propertyinfo to find the following information: attribute name, data type, declaration type, reflection type, read-only or writable status, and get or set the attribute value. You can use parameterinfo to find the following information: Parameter Name, data type, whether the parameter is an input parameter or an output parameter, and the position of the parameter in the method signature. It is an incredible thing to describe how to dynamically build an assembly. For example, we can create an assembly while interacting with users, the user selects the functions they need to create a response assembly for the user. This is not the software that the user receives. It is actually a live software that can complete the final code only after interacting with the user. The software previously provided to the user is the final form. framework class: Metadata Assembly PE file custom property reflection application domain security thread as long as the question can be pulled to the framework, all the strings will be put together, one by one, event tactics, as long as you think of this, you can move closer to this.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.