Search code examples
c#extension-methodsironpython

Is there a way to import an extension method for a number type into IronPython code?


I want to import the number extensions from the compiled C# assembly to the IronPython code. Various extension methods seem to be imported ok, but not the ones for the number types.

I have defined int, double and float extensions, but code like 50.Seconds() gives an unexpected token (Seconds) error. Is there any workaround to add a number type extension?


Solution

  • (1).__index__()
    

    may work.It is a part of the language when you put braces.I can't check that for IronPython right now :)