Take a look at the example below:
struct MyStruct
{
private volatile int _field;
public void Set(int v) => _field = v;
}
class MyClass
{
private MyStruct _myStruct;
// is it same as _myStruct.Set(0)?
public void SomeMethod() => _myStruct = new MyStruct();
}
Basically the question is whether reassigning the whole struct with a volatile field inside uses the same volatile semantics as assigning the field directly.