-
Notifications
You must be signed in to change notification settings - Fork 1
Reflection
Mario Gutierrez edited this page Jan 7, 2017
·
1 revision
Classes used for reflection are located in the System.Reflection namespace.
-
Assembly- Contains members that allow loading, investigation, and manipulation of an assembly. -
AssemblyName- Used to find details about the identity of an assembly. EventInfoFieldInfoMemberInfoMethodInfo-
Module- Provides access to a given module within a multifile assembly. ParameterInfoPropertyInfo
The -Info classes provide information and manipulation for those things.
The Type class is another class used heavily in reflection.
To get a reference to a type you can use typeof() or GetType().
When calling Type.GetType() for a generic type, you must make use of a special syntax
involving a "back tick" character.
For example, for System.Collections.Generic.List<T>, do:
System.Collections.Generic.List`1
The number at the end is the number of generic parameters the type has.
You can use Assembly.Load() to load in an assembly unknown at compile-time. Then,
you can use System.Activator.CreateInstance() to create an instance of a class
from that assembly using late-binding.
- Abstract Classes
- Access Modifiers
- Anonymous Methods
- Anonymous Types
- Arrays
- Attributes
- Console I/O
- Constructors
- Const Fields
- Delegates
- Enums
- Exceptions
- Extension Methods
- File IO
- Generics
- Interfaces
- Iterators
- LINQ
- Main
- Null Operators
- Parameters
- Polymorphism
- Virtual Functions
- Reflection
- Serialization
- Strings
- Value Types
- "Base" Keyword
- "Is" and "As"
- "Sealed" Keyword
- nameof expression