Pythonnet function call to c# method with 2d List parameter fails

C# class

using System.Collections.Generic;
namespace List2dEx
    public class Test2dList
        public int MatrixTest(IList<IList<double>> matrix)
            return matrix.Count;
        public int VectorTest(IList<double> vector)
            return vector.Count;


import clr

import List2dEx
from System.Collections.Generic import List
from System import Double
from List2dEx import Test2dList

test = Test2dList()

val = List[Double]()
ret = test.VectorTest(val)

valList = List[List[Double]]()
ret = test.MatrixTest(valList)

List i.e method VectorTest works perfectly fine, but 2d list i.e method MatrixTest gives the error “No method matches given arguments for MatrixTest: (<class System.Collections.Generic.List[List[Double]]'>)”
When the Method signature is changed to List “public int MatrixTest(List<List> matrix)” then it works, but method signature cannot be changed.

Welcome to Python Discussions. Thanks for fixing the formatting.
Please let us know if the pop-up “Are you posting code?” did not show for you.

Old request to fix the formatting (kept collapsed for reference)

I am wondering if you noticed that this forum uses Markdown for post formatting. When you paste a program code directly into a post it will be almost certainly mangled by the Markdown formatting. You can probably see that the code in your post is mangled into an invalid code.

Did the following pop-up show for you when you were posting the message? The pop-up was enabled here recently.

Information for new users - #30 by ambv

Please edit your post to enclose your code snippets between lines with triple backticks as instructed in the pop-up.

Note that it is possible that in this forum there are not many users having enough experience with pythonnet / Python.NET.

You can check the chat and the mailing list of the project: