Calling C# GenericType<T> function library from python

82 views Asked by At

I am exporting 3 C# functions to a library to be called from a python script. Those C# functions are using generic Type as parameters. So that in my python script I can all them using any value type

Here are the 3 exported C# functions:

    public void TestValue_1_Parameter_wTypeT<T>(T value)
    public void TestValue_2_Parameters_Strings(string value, string param2)
    public void TestValue_3_Parameters_wTypeT<T>(string ident, T value)

I am able to properly call function 1 with different types for T value without any problem

    MyObj.TestValue_1_Parameter_wTypeT("hello world")
    MyObj.TestValue_1_Parameter_wTypeT(2)
    MyObj.TestValue_1_Parameter_wTypeT(24.4)
    MyObj.TestValue_1_Parameter_wTypeT(True)

Event the print log of typeof(T) is reporting properly in the C# library

I am also able to call function 2 with 2 string parameters

but I am unable to call function 3.

When doing so:

    MyObj.TestValue_3_Parameters_wTypeT("hello world", 2)

I have this error:

E    TypeError: No method matches given arguments for TestValue_3_Parameters_wTypeT: (<class 'str'>, <class 'int'>)

It looks like the signature is not found ?? Any idea ?

0

There are 0 answers