First, class library
1, this is not a class library.
If within the company you don't have a code (not a very confidential code), your colleague will, and your colleague writes a code on his computer. Let you use on your own computer, how to do it? See below:
(1) Your colleague created a Qiuhe class.
namespace ConsoleApplication59 // Note namespace { public class Qiuhe { publicint jiafa (intint b) { return A + b;}} }
(2) in the folder to find the name: Qiuhe.cs file, on your computer, you on your own computer, paste this file into the file you created, such as (first), and then your main function on the right side of the page "solution" has a "Show All Files" button, click, Just display the Qiuhe.cs file you need, select it, right-click, and select "Include In Project (J)" as (second). Add success!
(3) Refer to the Qiuhe.cs namespace in your action page, and then instantiate the Qiuhe, referencing the Jiafa method inside. Ok!!
2, the Real class library
If your company's main revenue is by selling code, then the code you sell to other companies will not let them see the specific code inside, it can not look like the above, this requires the class library.
(1) Create a class library with the name ClassLibrary5, and then click "Generate" ClassLibrary5 in "solution"
(2) Locate the file suffix. dll in debug, paste it into the debug file (ConsoleApplication61) of your operation, then click "References" on the right "solution" to find the DLL, file you pasted under the file.
(3) Reference namespace. Instantiate and refer to the method as above.
Second, the Commission
Note: The method you are delegating must be the same as the type of the method being delegated (necessary prerequisites)
1. Declaring the delegate type, (above the main function)
2. Create the delegate variable (f) and make the function point (new Qiuhe (). Jiafa) and perform the assignment operation.
At this point, f (AA,BB) is equivalent to Jia (A,BB).
Finish!!!
Object-oriented class 4-4 library delegates