How to hide some members of an interface

前端 未结 7 2207
甜味超标
甜味超标 2020-12-03 11:42

I would like to create a custom collection that implements ICollection.

But I would like not to expose some memebers of ICollection like

相关标签:
7条回答
  • 2020-12-03 12:36

    I would rather suggest you to consider "Composition" over "Inheritance" here.

    That gives you more control over what all to expose to the outer world, with added advantage of dynamic binding with the actual collection.

    0 讨论(0)
提交回复
热议问题