"is returning an ienumerable<> thread-safe?" Code Answer


no, it isn't.

if another thread adds to the dictionary while your caller enumerates that, you'll get an error.

instead, you can do:

lock (pool_lock_) {
    return foo_pool.values.tolist();
By Tiago Cogumbreiro on April 30 2022

Answers related to “is returning an ienumerable<> thread-safe?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.