How can I override operators to be used on builtin types like String, arrays etc? For example: I wish to override the meaining of the + operator for arrays.
Basically you can't.
You can use extension methods to add functionality like this:
public void CustomAdd( this Array input, Array addTo ) { ... }
But this doesn't work with operators.
2.1m questions
2.1m answers
60 comments
57.0k users