Skip to main content

Reflecting on Generated Code

  • Chapter
  • First Online:
Code Generation with Roslyn
  • 731 Accesses

Abstract

Generated code will always be code that was not known at compile time. The whole point of generating code is to make it easier to change the business rules after deployment. This is where reflection comes in. Reflection allows you to access metadata about your code at runtime. With it, you can load an assembly, discover the types in the assembly, create an instance of these types, and systematically execute any method discovered in these types. This is exactly what you need to evaluate new business logic.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 19.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 29.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Nick Harrison

About this chapter

Cite this chapter

Harrison, N. (2017). Reflecting on Generated Code. In: Code Generation with Roslyn. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-2211-9_7

Download citation

Publish with us

Policies and ethics