Hi,
if error occur, what happen to my myobj? is it dispose or not?PHP Code:using (object myobj = new object())
{
// code here
// error occur here
// code here
}
Thanks,
POpskie
Printable View
Hi,
if error occur, what happen to my myobj? is it dispose or not?PHP Code:using (object myobj = new object())
{
// code here
// error occur here
// code here
}
Thanks,
POpskie
The whole point of the 'using' keyword is exactly that: the object is disposed even if an exception is thrown within. That's the whole reason for its existence. That's also the reason that only types that implement the IDisposable interface can be created by a 'using' statement.
Please provide descriptive thread titles.
Thanks jm Im just curious.