So, as you rightly said, list[0] is a copy of the value in the list. This value is not a variable. One of the meanings in this struct is ChildFoos . The value of this field is not a series of instances of Foo; instead, it is a reference to a bunch of information stored elsewhere (since arrays are reference types). The copy of the Foo instance you got back has a copy of the link that the instance has inside the list.
If you had to change the link itself, say by assigning a new ChildFoos array, you will see the same error that you see when you try to change any other field of this structure, for example, when you try to mutate A Since you only read the value of the link that the struct stores (and does not mutate an instance of the structure), then it goes over and gets the first element in this array, and since the index index of the array returns a variable, not a value (again, as you correctly noted in the question ), mutating, which returned the instance of Foo , mutates the instance in the array, since it is not a copy, so when you access the same array again, you can observe the change later.
source share