I have this (for illustration only) C # code:
using( new System.IO.MemoryStream() ) { System.Threading.Thread.Sleep(1000); }
Note that a MemoryStream is created here and is clearly not bound to a link. Therefore, if there is no special treatment due to the using statement, the object has no references to it and can be assembled before the control leaves the using statement and, possibly, even before Sleep() .
Is a MemoryStream suitable for collection before control leaves the using statement?
source share