I'm trying to overload several operators for a vector class I'm porting from C++ to C# (nothing serious, just playing around with C# to get some feeling for it).
From the tutorials I read I learned that overloaded operators always have to be static. This is fine for stuff like +, -, *.... but what about += ?
I read that C# will use the + operator here, but this means that the result of, say a+b, has to be stored in a temporary object which is then assigned to the variable on the left side of +=.
The C++ class I'm porting uses a non-static operator and simply adds b to a's private fields (x,y,z) without returning anything. Is there anything similar I could do in C#? Or is this kind of optimization automatically done at compiletime?