Appendix C. Reflection and Attributes


Reflection is the programmatic act of reading the metadata associated with a type. You can read the metadata to learn what the type is and what is it made of (i.e., methods, properties, base classes). Reflection services are defined in the System.Reflection namespace. Reflection is most useful in conjunction with attributes, which are a way of adding information to a type and affecting the type's behavior. Reflection also has another esoteric feature not covered in this appendix: it allows you to define new types during runtime and emit the corresponding IL code and metadata (using the services found in the System.Reflection.Emit namespace). This appendix starts by reviewing some key .NET reflection techniques and then focuses on using and defining attributes.



Programming. NET Components
Programming .NET Components, 2nd Edition
ISBN: 0596102070
EAN: 2147483647
Year: 2003
Pages: 145
Authors: Juval Lowy

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net