1. generate dll
building .cs file, for example: myDll.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DZTT { public class Operate { public int getSum(int a, int b) { return a + b; } } } View Codeenter vs menu->cmd
csc /target:library /out:myDll.DLL myDll.cs
2. building console project testDll
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DZTT; namespace TestDll { class Program { static void Main(string[] args) { Operate operate = new Operate(); int c = operate.getSum(10 ,20); Console.WriteLine(c.ToString()); } } } View Code3. Project->Add reference, add myDll.dll
ok.
转载于:https://www.cnblogs.com/https/p/9642884.html
相关资源:数据结构—成绩单生成器