c# - Why use ImmutableList over ReadOnlyCollection? -


.net 4.5 has new namespace system.collections.immutable

this package provides collections thread safe , guaranteed never change contents, known immutable collections.

i'm confused. isn't thread safety problem solved readonlycollection class? why use immutablelist instead?


i know there's ireadonlylist interface. doesn't solve thread safety problem implicitly, because other threads may edit object interface.

with readonlycollection:

a collection read-only collection wrapper prevents modifying collection; therefore, if changes made underlying collection, read-only collection reflects changes.

this can't happen immutablelist.


Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -