我写个了小sample
1.cs
using System;
public class MyClass
{
public static string GetStr()
{
return "this is a sample.. haha i am Taye";
}
}
在cmd中
csc /t:library 1.cs
生成了1.dll
2.cs
using System;
public class MyClass2
{
public static void Main()
{
Console.WriteLine(MyClass.GetStr());
}
}
在cmd中
csc /t:exe 2.cs /r:1.dll
生成了2.exe
2.cs中使用了1.dll中的MyClss.GetStr()的一个静态方法。所以在编译时要先引用
/r:1.dll
浙公网安备 33010602011771号