Qus:    What is the best approach to use collections in multi-threaded applications?
Nov 23, 2020 20:45 DotNet 2 Answers Views: 1358 RAMU

Immutable collection take a different approach in making collections thread-safe. As concurrent collections use synchronization locks instead, immutable collections can’t be changed after they are created. Automatically it makes them safe to use in multi-threaded scenarios since there’s no way for another thread to modify them and make the state inconsistent. This design decision definitely affects the API of immutable collection classes. They don’t even have public constructors.

Prev Next
Answers (2)
PARTH Nov 24, 2020 14:14
Answer:   The concurrent collection classes can be safely used in multi-threaded applications. Immutable collections can’t be changed after they are created, so can also use them in multi-threaded applications.

DIVYA Nov 24, 2020 14:40
Answer:   Immutable collection take a different approach in making collections thread-safe. As concurrent collections use synchronization locks instead, immutable collections can’t be changed after they are created. Automatically it makes them safe to use in multi-threaded scenarios since there’s no way for another thread to modify them and make the state inconsistent. This design decision definitely affects the API of immutable collection classes. They don’t even have public constructors.

Post Your Answer
Guest User

Not sure what solution is right for you?

Choose the right one for you.
Get the help of the experts and find a solution that best suits your needs.


Let`s Connect