I have a library written in C# and it goes like this
class FooCollection
{
private readonly FooBase _innerFoo;
public FooCollection()
{
_innerFoo = new FooBase();
}
public string this[int index]
{
get { return _innerFoo._components[index].ComponentName; }
set
{
_innerFoo._components[index].ComponentName = value;
}
}
}
And this class is COM visible and I'm trying to use it from Python. So, this command works
foo(1)
but this one doesn't
foo(1) = 'SomeName'
It gives me "can't assign to call function". I tried square brackets [], but that is no good. Is there any way to bypass this, except me making additional 'normal' method in C# to set this property?
I'm using pywin32-218 for COM in Python.
foo = win32com.client.Dispatch("Foo")
Indexed property translates into IL, like
FooCollection.get_Item and FooCollection.set_Item, so probabbly in the final COM object
translated too.
Try to use these function calls.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With