CreganTur
January 6th, 2010, 07:37 AM
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?
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?