InProgramAfter writing the program, if we want to constantly upgrade the functions of the program and use the previous ideas to write the program, we can only add and change the main programCodeIs there no other way? The answer is yes. How can this problem be achieved? -- Plug-in!
Yes, it is the plug-in, just like our eclipse, that is, the program "built" by the plug-in, using the plug-in, we can easily add and modify the functions of the program without re-compiling the entire project. This is the benefit of using plug-in technology! Below are some of the methods I have used in actual development. I have sorted them out for your reference .... (Here is just an example of dynamically loading a class! And so on !)
/********************************** Main program **** *************************/
// Load the assembly of the class
Assembly = assembly. loadfrom ("C: \ maxun \ test. dll ");
Type type = assembly. GetType ("test. outstring ");
// Obtain the specified Method
Methodinfo met = type. getmethod ("outsuccess ");
// Create an instance
Object OBJ = system. activator. createinstance (type );
// Call Method
String strresult = (string) met. Invoke (OBJ, null );
// If this method has parameters, you can use the following methods to implement it:
/*
Object [] objarray = new object [7];
Objarray [0] = "parameter 1 ";
Objarray [1] = "parameter 2 ";
Objarray [2] = "parameter 3 ";
............
* ** Result = (***) met. Invoke (OBJ, objarray );
*/
/********************************** Class code **** *************************/
Using system;
Namespace Test
{
Public class outstring
{
Public outstring ()
{
}
Public String outsuccess ()
{
Return ("Success :)");
}
}
}
********* ******************/