Showing posts with label Reflection. Show all posts
Showing posts with label Reflection. Show all posts

Sunday, August 9, 2009

Chapter 14-Lesson 3

  • GetTypes( ) method on an Assembly objects returns all types (classes) in all the Modules of the Assembly.
  • However, the same method may be called on a Module class to get all the types present in that particualr Module.
  • The GetType( ) method or typeof keyword (in C#) may be used over an object to ask it about its type.
  • The Fullname property of the Type class gets a fully qualified name for the Type, without the assembly information.
  • GetCustomAttributes( ) method may also be used over Type class.
  • See "What type is that Object?" on page 858.
  • MemberInfo is an abstract class and all other ...Info classes derive from it.
  • The Type class also derives from MemberInfo class.
  • MemberInfo -> MethodBase -> MethodInfo is the inheritance hierarchy for MethodInfo and ConstructorInfo classes.
  • MemberType enumeration defines possible types of members.
  • By default, the Get...( ) methods return only public members within a Type.
  • To have more control while getting members of a type, we use BindingFlags enumeration. e.g. to get protected, internal and private members, use BindingFlags.NonPublic.
  • We may use more than one BindingFlag values (using operator) during a Get...( ) method call.
  • MethodBody class represents IL Code and local variables for a particular MethodBase object.

Chapter 14-Lesson 1

  • An Assembly consists of the following parts: Assembly metadata, Type metadata, IL Code, Resources.
  • Assembly metadata is also called the manifest and contains information such as Strong Name, Version, Culture, etc.
  • Type metadata contains information about all the classes, structs, interfaces and their members.
  • Resources contain objects like images, strings, etc.
  • An Assembly may consist of multiple files.
  • The Assembly class is used to represent a .NET assembly in the code.
  • The Load( ) static method if this class loads the specified Assembly in the current AppDomain.
  • Each assembly contains one or more modules that represent containers for type information.