Volatile for structs and collections of structs
问题 I would like to use net wisdom to clarify some moments regarding multi-threading in .net. There are a lot of stuff in the internet about it however I was not able to find a good answer to my question. Let say we want to maintain a state of something in our class with safety for concurrent threads. Easy case is when state is int: class Class1 { volatile int state = 0; public int State { get { return state; } } public Action<int> StateUpdated; public void UpdateState(int newState) { state =