我有以下的C#代码。如何使用F#中的C#对象?
namespace MyMath {
public class Arith {
public Arith() {}
public int Add(int x, int y) {
return x + y;
}
}
}
,我想出了一个名为testcs.fs使用这个对象的F#代码。
open MyMath.Arith
let x = Add(10,20)
当我运行下面的命令
fsc -r:MyMath.dll testcs.fs
我得到这个错误信息。
/Users/smcho/Desktop/cs/namespace/testcs.fs(1,13): error FS0039: The namespace 'Arith' is not defined /Users/smcho/Desktop/cs/namespace/testcs.fs(3,9): error FS0039: The value or constructor 'Add' is not defined
什么可能是错的?我使用单一的.NET环境。
它工作正常。谢谢。 – prosseek 2010-10-10 19:36:23