用VS2005写C#调用自己写的DLL,刚学会,激动一下呵呵
完整的例子,出自MSDN
示例
// File: Add.cs
namespace UtilityMethods
{
public class AddClass
{
public static long Add(long i, long j)
{
return (i + j);
}
}
}
// File: Mult.cs
namespace UtilityMethods
{
public class MultiplyClass
{
public static long Multiply(long x, long y)
{
return (x y);
}
}
}
// File: TestCode.cs
using UtilityMethods;
class TestCode
{
static void Main(string[] args)
{
System.Console.WriteLine("Calling methods from MathLibrary.DLL:");
if (args.Length != 2)
{
System.Console.WriteLine("Usage: TestCode <num1> <num2>");
return;
}
long num1 = long.Parse(args[0]);
long num2 = long.Parse(args[1]);
long sum = AddClass.Add(num1, num2);
long product = MultiplyClass.Multiply(num1, num2);
System.Console.WriteLine("{0} + {1} = {2}", num1, num2, sum);
System.Console.WriteLine("{0} {1} = {2}", num1, num2, product);
}
}
有些东西是要一点点积累的