Force subclasses of an interface to implement ToString

后端 未结 7 2127
猫巷女王i
猫巷女王i 2020-12-28 11:19

Say I have an interface IFoo and I want all subclasses of IFoo to override Object\'s ToString method. Is this possible?

Simpl

7条回答
  •  鱼传尺愫
    2020-12-28 12:02

    Implementing an interface method implicitly seals the method (as well as overriding it). So, unless you tell it otherwise, the first implementation of an interface ends the override chain in C#.

    Essential .NET

    Abstract class = your friend

    Check this question

提交回复
热议问题