Why can '=' not be overloaded in C#?

前端 未结 12 878
离开以前
离开以前 2020-12-30 00:49

I was wondering, why can\'t I overload \'=\' in C#? Can I get a better explanation?

12条回答
  •  醉话见心
    2020-12-30 01:35

    Because shooting oneself in the foot is frowned upon.

    On a more serious note one can only hope you meant comparison rather than assignment. The framework makes elaborate provision for interfering with equality/equivalence evaluation, look for "compar" in help or online with msdn.

提交回复
热议问题