July 2003
Intermediate to advanced
736 pages
16h 35m
English
Just as you are likely to reflect types and create instances, you will encounter scenarios where you want to explore other members of types. In this section I will demonstrate how to use Reflection to request other kinds of members.
Type objects are used to interact with members of a type. You use Type.InvokeMember to invoke Reflected members whether those members are methods, properties, events, fields, or whatever. The key to invoking the member correctly is providing the correct information to the InvokeMember method, including the correct BindingFlags enumerated values. Listing 4.8 demonstrates how to invoke a protected method member.
Read now
Unlock full access