Valid applications of member hiding with the new keyword in c#

后端 未结 7 2344
终归单人心
终归单人心 2021-02-18 16:22

I\'ve been using c# since version 1, and have never seen a worthwhile use of member hiding. Do you know of any?

7条回答
  •  闹比i
    闹比i (楼主)
    2021-02-18 16:52

    Generally it's considered bad practice to reject an inherited member. The only time I've used it is in generated code where the new member provided a more specific type in the same class hierarchy. Same goes for explicit interface implementations.

提交回复
热议问题