Re: [Python.NET] Invoking a C# method with a python list
Denis Akhiyarov <[email protected]> Mon, 24 Sep 2018 09:20:33 -0500
| Newsgroups | gmane.comp.python.dotnet |
|---|---|
| Message-ID | <CALxxJLTGbPWDZGd3NPeufO=Roo_Yfz9kNY+5emNEcDJbvozo5w@mail.gmail.com> |
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. https://github.com/pythonnet/pythonnet/issues/265 On Thu, Aug 2, 2018 at 10:11 AM Mohamed Koubaa <[email protected]> wrote: > 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 - [email protected] > https://mail.python.org/mailman/listinfo/pythondotnet > _________________________________________________ Python.NET mailing list - [email protected] https://mail.python.org/mailman/listinfo/pythondotnet