|
-
January 6th, 2010, 08:37 AM
#1
Should I use a Using block?
I've got a program that loops through hundreds of records. In many cases a Stream will write out some data from each record. Which is optimal: declare my stream object outside the Loop, call its methods within the loop, and then Close() the stream after the loop ends, or is it better to place a Using block within the loop?
I question this because it seems to me that it would be more taxing for my program to constantly initialize and release this object within the loop.
What do you guys think?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|