16Reflection, Metadata, and Dynamic Programming

INSPECTING CODE AT RUNTIME AND DYNAMIC PROGRAMMING

This chapter focuses on custom attributes, reflection, and dynamic programming. Custom attributes are mechanisms that enable you to associate custom metadata with program elements. This metadata is created at compile time and embedded in an assembly. Reflection is a generic term that describes the capability to inspect and manipulate program elements at runtime. For example, reflection allows you to do the following:

  • Enumerate the members of a type.
  • Instantiate a new object.
  • Execute the members of an object.
  • Find out information about a type.
  • Find out information about an assembly.
  • Inspect the custom attributes applied to a type.
  • Create and compile a new assembly.

This list represents a great deal of ...

Get Professional C# 7 and .NET Core 2.0, 7th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.