.NET Threading - is lock needed for assignments
问题 I've got some multi threaded code I'd like to increase the performace of a bit, so I'm wondering if I can get rid of a lock. I've got a field member: private IList<ServerStatus> status; It's updated in a thread like so: status = GetUpdatedStatus(); And it's used in another thread like this: var currentStatus = status; So the question is, can the above yield any problems without locks around the two assignment statements ? I guess the only scenario I can see is currentStatus being null, but