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.
1.4m articles
1.4m replys
5 comments
57.0k users