How to pass an IronPython instance method to a (C#) function parameter of type `Func<Foo>`
Question: 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(self):
            return Foo()
    CSharpClass().DoSomething(foobar)
    

But I'm getting the following error:

**TypeError: expected Func[Foo], got instancemethod**


Answer: OK. I think I might have found a solution:

    
    
    import clr
    clr.AddReference('System')
    clr.AddReference('System.Core')
    
    from System import Func
    
    class IronPythonClass:
    def foobar(self):
        return Foo()
    
    CSharpClass().DoSomething(Func[Foo](foobar))
    

The interesting bit is the `Func[Foo]`constructor :)

