Read-only list or unmodifiable list in .NET 4.0

前端 未结 6 1305
清酒与你
清酒与你 2020-12-05 08:58

From what I can tell, .NET 4.0 still lacks read-only lists. Why does the framework still lack this functionality? Isn\'t this one of the commonest pieces of functionality fo

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-05 09:45

    For those who like to use interfaces: .NET 4.5 adds the generic IReadOnlyList interface which is implemented by List for example.

    It is similar to IReadOnlyCollection and adds an Item indexer property.

提交回复
热议问题