This site is 100% ad supported. Please add an exception to adblock for this site.

70-536 - Reflection

Terms

undefined, object
copy deck
What is a module?
A module is a portable executable file, such as type.dll or application.exe, consisting of one or more classes and interfaces. There may be multiple namespaces contained in a single module, and a namespace may span multiple modules.
What static method returns the assembly that called the current method?
GetCallingAssembly()
What static method returns the assembly that started up the current process?
GetEntryAssembly()
What static method returns the assembly that contains the currently executing code?
GetExecutingAssembly()
How to get type information directly from any object?
Call the GetType method of the object class
How to enumerate type members, including methods, properties, field, events and enumerations?
Use the MemberInfo class
How to enumerate all types in a particular assembly
GetTypes from the assembly class
What are BindingFlags for?
Control over what members to retrieve from a type
How to create a new instance of a Type? Reflection
"Use the Type class and the ConstructorInfo class.
Type myHashTable = myAssembly.GetType(""Syst⬦Hashtable"");
Type[] args = Type.EmptyTypes
ConstructorInfo constr = myHashTable.GetConstructor(args)"
How to execute arbitrary code for specific instance of a type?
Use the MemberInfo class
Show the difference in invoking a static method and a instance method using the MemberInfo class
"myMethod.Invoke(null, new object[]{""myString""}); // static
myMethod.Invoke(myObject, new object[]{""myString""}); // instance"

Deck Info

11

permalink