> Hi everyone;
>
[quoted text clipped - 19 lines]
> pinning the entire object." But what does "the entire object" mean? Is it
> just str1
A reference type, such as System::String, can never be a sub object. The
only object that gets pinned is the string instance referenced by str1.
Also, you should please avoid abusing keywords such as class, if you expect
people to take your example code seriously.
> and MyClass? Or are the subObjects list and the elements contained in it
> also pinned? Does the runtime pin each and every object that can be
> reached from the parent object?
Even if you had pinned the parent object, by using a pinning pointer to a
value type (value typed member variables actually are sub-objects), then
only the parent object would be pinned. Reachable objects are not affected,
since the garbage collector can still update the parent object to point to
the new location of the other instances, just not move the parent itself.
> A second question. Why is it not possible to pin a reference type directly
> using pin_ptr? Like;
[quoted text clipped - 5 lines]
>
> Regards...