How to pass an IronPython instance method to a (C#) function parameter of type `Func<Foo>`
- by Daren Thomas
I am trying to assign an IronPython instance method to a C# Func<Foo> parameter.
In C# I would have a method like:
public class CSharpClass
{
public void DoSomething(Func<Foo> something)
{
var foo = something()
}
}
And call it from IronPython like this:
class IronPythonClass:
def foobar():
return Foo()
CSharpClass().DoSomething(foobar)
But I'm getting the following error:
TypeError: expected Func[Foo], got instancemethod