for example
using (Stream ftpStream = ftpResponse.GetResponseStream()) // a
using (FileStream localFileStream = (new FileInfo(localFilePath)).Create()) // b
{
........do something
}
will the two statement a and b executed in the order i put?
and displose in the same order as well??
Thanks
They will execute in textual order, and be disposed in reverse order – so
localFileSreamwill be disposed first, thenftpStream.Basically your code is equivalent to:
It goes further than that though. Your code is also equivalent (leaving aside the different type of
localFileStream) to this: