[Python.NET] Invoking a C# method with a python list

Denis Akhiyarov denis.akhiyarov at gmail.com
Mon Sep 24 10:20:33 EDT 2018

This link below is probably a good staring point for "TypeError: No method
matches given arguments". But ideally we should bring back the skipping of
method resolution logic within a context manager whenever the user knows
what he/she is doing. There is also explicit `.Overloads` option to force
through one of the overloaded methods.


On Thu, Aug 2, 2018 at 10:11 AM Mohamed Koubaa <mohamed.koubaa at ansys.com>

> Hello,
> I am using the 2.3 release branch.
> I have C# code like this:
>     public class A {
>         public A() {...}
>     }
>     public class B {
>         public B() {...}
>         public static void Func(IEnumerable<A> input){
>         }
>     }
> I want to pass in a python list to Func but get this error:
> >>> b=B()
> >>> b.Func([A(), A()])
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: No method matches given arguments
> I tried both IEnumerable and IList in the signature of 'Func'.  I know
> that I can import System and create some .NET collection type and it works
> well.
> Did I miss anything?  Is this usage pattern within the design goals of
> pythonnet?  I assume this would have to be fixed in MethodBinder but I
> wanted to try asking here first.
> Thanks!
> Mohamed Koubaa
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> https://mail.python.org/mailman/listinfo/pythondotnet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20180924/2f4e6d30/attachment.html>

More information about the PythonDotNet mailing list