C# – Cross thread reading of a variable who’s value is not considered important


In c#, is there a way of updating a variable (without using lock) where multiple threads can read the value, but the thread that updates the variable is not considered important.

What I mean is, if a thread updates that value but the other threads don't get that updated value a few minutes later then that is OK.

Is there such a way?

Many thanks

Best Solution

The best option is to use a ReaderWriterLockSlim (or a ReaderWriterLock if you're not using .net 3.5). Tip: This tutorial should get you started.