Reflection is a runtime facility that allows you to write code that can interrogate data types at runtime. This means that you can obtain information about the data type of variables. More than that, it means that you can obtain information about class members, properties, methods, fields, constructors, and much more.
This chapter introduces you to the basics of reflection: what it is and how it works. Then, you will see how to use reflection to work with methods, members (fields, properties, and so on), events and more. Finally, you will see how reflection works to allow you to create and consume custom attributes that can be used to decorate your class with metadata that can be read at runtime.