Added a decoder to be able to handle Func<> parameters by Romout · Pull Request #2049 · pythonnet/pythonnet
What does this implement/fix? Explain your changes.
It's a decoder to ease use of C# Func<> method arguments. Previously, it was necessary to cast the python lambda expression to System.Func[...] which is very cumbersome for a script-user.
Does this close any currently open issues?
Was not my intention.
Any other comments?
The solution I used is quite complex as it needs to create wrapper types for each Func-Type-Variant. Code creation is implemented using the IL Code Generator, types are cached, generic type arguments are again converted using ToPython()
I hope my change is of some help!
Checklist
Check all those that are applicable and complete.
- Make sure to include one or more tests for your change
- If an enhancement PR, please create docs and at best an example
- Ensure you have signed the .NET Foundation CLA
- Add yourself to
AUTHORS - Updated the
CHANGELOG