.NET Development Foundation/Interoperability Topics

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Interoperability, Reflection, and Mailing: Topics




The Wikipedia definition for reflection in computer science is: "The process by which a computer program can observe and modify its own structure and behavior. The programming paradigm driven by reflection is called reflective programming".

The concept is implemented extensively in .NET because a lot of information is maintained at the common intermediate language (CIL) level.

Among other things you can:

  • get information about running assembly or assembly constituents (modules, classes, methods, etc.), this is particularly useful for dynamically loaded assemblies that are not known at compile time.
  • put custom attributes in your code and retrieve those attributes at run time.
  • dynamically invoke methods.
  • "emit" and execute CIL code at run time.