It is also unfamiliar with the reflection and poor path, so now you have time to take a look at the reflection and take notes !!!
Reflection definition: Reflection (Reflection) is. NET, which can be obtained at runtime through radiation. NET, including methods, attributes, events, and constructor. You can also obtain the name, qualifier, and parameters of each member. With reflection, you can be familiar with every type. If you obtain information about the constructor, you can directly create an object, even if the object type is unknown during compilation.
1. Import using System. Reflection;
2. Assembly. Load ("Assembly") // Assembly. LoadFile ("dynamic library for external calls") loads the Assembly. The return type is an Assembly
3, foreach (Type type in assembly. GetTypes ())
{
String t = type. Name;
}
Obtain the names of all classes in the dataset.
4, Type type = assembly. GetType ("assembly. Class Name"); get the Type of the current class
5. Activator. CreateInstance (type); Create an instance of this type.
6, MethodInfo mInfo = type. GetMethod ("method name"); get the current method
7. mInfo. Invoke (null, method parameter );
These are some basic applications of reflection ,,,
The above is just a basic learning of reflection. I will read more and practice more in the future !!!