У меня есть следующий код C # для компиляции в сборку MyMath.dll.
namespace MyMath {
public class Arith {
public Arith() {}
public int Add(int x, int y) {
return x + y;
}
}
}
И у меня есть следующий код IronPython для использования этого объекта.
import clr
clr.AddReferenceToFile("MyMath.dll")
import MyMath
arith = Arith()
print arith.Add(10,20)
Когда я запускаю этот код с IronPython, я получаю следующую ошибку.
Traceback (most recent call last):
File ipycallcs, line unknown, in Initialize
NameError: name 'Arith' is not defined
Что может быть не так?
ДОБАВЛЕНО
arith = Arith () должен был быть arith = MyMath.Arith ()