473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 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 1011
<=?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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mike J | last post by:
I have several stored procedures that run fine from my SQL Server database (via the exec command.), though when I call these procedures from my web application, they do not complete. I have other...
5
by: Mike J | last post by:
I have several stored procedures that run fine from my SQL Server database (via the exec command.), though when I call these procedures from my web application, they do not complete. I have other...
2
by: sudhashekhar30 | last post by:
hi all i have textbox in step in wizard control(step-10). there are 10 steps. so i want validation on every page and user can't move to other step without completing all correct entry. when i...
1
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... There are a few questions wrapped up in this, but the main one is that the WebService.MyMethodAsync() methods that are automatically generated in the client code by VS 2005 don't seem to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.