Somebody mentioned that it would make sense to overload + in e.g. Color struct. But how can I do it? I thought it needs to be inside of the type.
3 Answers
Operators involve 2 operands, and you have the chance of placing the operator overload into eather of the 2 types involved.
In other words, you can write your own custom type, and add operators that makes it interact with Color, but if you want Color and int to interact with new operators, then sorry, no, you can´t do that.
+red and red? Double red?Color.FromARGB(Math.Min(255, c1.A + c2.A), ...)