Possible Duplicate:
Are C# auto-implemented static properties thread-safe?
In the following example class
static class Shared
{
public static string[] Values { get; set; }
}
many reader threads read the Values
string array periodically, while from time to time a single writer will replace the whole array with a new value using the setter. Do I need to use a ReaderWriterLock
or is this something C# will handle automatically?
Edit: In my case the only required "thread safety" is: Nothing bad should happen when the writer replaces the array while the reader is searching for a value. I don't care if the readers will use the new value immediately as long as they will use it in the future