Operator Overloading For Builtin Types

后端 未结 4 1605
渐次进展
渐次进展 2020-12-21 15:35

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.

4条回答
  •  甜味超标
    2020-12-21 16:40

    You can't :)

    You can however for the array example inherit from an IEnnumerable or List ... and override those operators.

提交回复
热议问题