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

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -