We know from the C # specification that read / write links are atomic. In a statement that refers to a member of an object, will the reference to the link be also atomically accessible? I think yes, because it is also a kind of implicit reference reading, which the compiler must provide atomicity when creating code for it.
In the same statement, access to an object to access its member will cause the reference to the objects to be saved so as not to collect garbage when a new instance is created by another thread?
So, if we refer to the members in the chain, will the link with the left objects be also saved, so this is not garbage collected by other threads?
Consider the following code:
static SomeClass sharedVar;
void someMethod()
{
SomeClass someLocalVar = sharedVar.memberX.memberY.a;
operations on someLocalVar...
}
, MSDN, # .. Microsoft, , , .