I wonder if I must define a commutative operator (like *) twice!
public static MyClass operator *(int i, MyClass m)
{
return new MyClass(i *
Order is sometimes important in operators, the classic examples being subraction (-) and division (/). However, it can also apply to multiplication:
Consider, for example, that they are vectors - x is a (2×1) vector, and y is a (1×2) vector. If we interpret * as matrix multiplication, then x * y is a (2×2) vector, but y * x is a (1×1) vector.
As such, the C# compiler does not assume that binary operators are commutative, even if they commonly are (addition (+), multiplication (*), etc).