How to define a c# class to support IronPython power operator **

Hailiang Shen
 

Hello all, I am defining a C# assembly to be used in IronPython. For one C# class, I need to support the IronPython power operator (**). For example in IronPython

 

MyClass1 ** 3 will automatically call my power function defined on my C# class.

MyClass1 ** MyClass2 will also automatically call my power function defined on my C# class.

 

It is simple to overload the overloadable operators https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/statements-expressions-operators/overloadable-operators, but I am not sure how to support the power operator. Could you suggest which C# operator I need to overload or is there one?

 

Hailiang

Join users@ironpython.groups.io to automatically receive all group messages.