Closed
Description
Hi,
this is a change request:
Environment
- Pythonnet version: 2.3.0.0
- Python version: 3.6.5 32-bit
- Operating System: Win 10
Details
In a python module, we want to call a C# Method, that has named optional parameters. But these are ignored.
Reason: The MethodBinder.Bind(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info, MethodInfo[] methodinfo) Method ignores the passed python keyword-arguments. But instead, it should assign them to the C# named parameters, if appropriate. Can you extend pythonnet to support named parameters?
snip
- C#
public class LibWithDefault
{
public static string FuncWithDefault(int x, object b = null)
{
return $"x: {x} b: {b} ";
}
}
- Python
import clr
clr.AddReference("CS_DefaultParam")
from CS_DefaultParam import LibWithDefault
res = LibWithDefault.FuncWithDefault(x=3, b=4)
print(res)
Metadata
Metadata
Assignees
Labels
No labels