C # Reflection

Source: Internet
Author: User

What is reflection?

Reflection provides objects (type types) that encapsulate assemblies, modules, and types. You can use reflection to dynamically create instances of types. Binds a type to an object in Xi ' an.

Or get the type from an existing object and call its methods or access fields. If your code uses attributes, you can also use reflection to access them.

as a general rule, it is a way to understand the inside of an object.


Code 1 shows the use of the GetType () method to obtain object type information.

      int i =;      System.Type Type = I.gettype ();      System.Console.WriteLine (type);

//Code 2 shows a way to get information about a dynamic-link library

     System.Reflection.Assembly o = System.Reflection.Assembly.Load ("mscorlib.dll");     System.Console.WriteLine (O.getname ());


http://blog.csdn.net/ilipan/article/details/45486143



C # Reflection

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.