[IronPython] Trouble calling a method on a .NET object
Orian, Helmut
helmut.orian at schema.de
Wed Jun 11 15:09:07 CEST 2008
I'm having trouble calling a method on one of my .NET objects.
if you compile the following repro into a "test.dll":
namespace Test {
public interface ISomeInterface {
string Greet();
}
public abstract class Base {}
public static class SomeFactory {
public static object Get() {
return new Concrete();
}
}
internal class Concrete : Base, ISomeInterface {
public string Greet() {
return "Hello world!";
}
}
}
and try to use them:
>>> import clr
>>> clr.AddReference("test")
>>> from Test import *
>>> o = SomeFactory.Get()
>>> print("Greet" in dir(o))
True
>>> print(o.Greet())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: expected ISomeInterface, got Base
To me it looks like a bug regarding collection of polymorphic
information on .NET types;
or am I missing something?
Thanks,
Helmut
---------------------------------------------------------------------------
An- und Abmeldung zur SCHEMA Mailingliste unter http://www.schema.de/mail
---------------------------------------------------------------------------
More information about the Ironpython-users
mailing list