471,327 Members | 2,653 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,327 software developers and data experts.

Not completing a using block

Is there any difference in resource usage (or rather disposal between)

using (something resource intensive)
{
DoSomething()
}
return

....and....

using (something resource intensive)
{
DoSomething()
return
}

--
Paul
Jan 4 '06 #1
2 974
<=?Utf-8?B?UGF1bHVzdHJpb3Vz?= <msdn_whoisat_paulcotter.com>> wrote:
Is there any difference in resource usage (or rather disposal between)

using (something resource intensive)
{
DoSomething()
}
return

...and....

using (something resource intensive)
{
DoSomething()
return
}


Well, if the return statement needs to evaluate anything, the order of
disposal and evaluation will change. In both cases Dispose is called
though.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 4 '06 #2
Hi,


"Paulustrious" <msdn_whoisat_paulcotter.com> wrote in message
news:79**********************************@microsof t.com...
Is there any difference in resource usage (or rather disposal between)

using (something resource intensive)
{
DoSomething()
}
return

...and....

using (something resource intensive)
{
DoSomething()
return
}

Nop, personally I prefer the first one.

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 4 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by =?Utf-8?B?TWFyaw==?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.