Is there a .NET collection interface that prevents adding objects?

前端 未结 7 1705
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-18 18:13

I have a class that maintains list of objects of another class. List of objects is a public property. I would like to prevent users from adding and removing objects directly

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-18 18:43

    ICollection (the non-generic version) only got IEnumerable + Count

提交回复
热议问题