Amazon.com Widgets

Close and Dispose...

Joe has a little quiz about Close() and Dispose()

Trivia: Should you call Close() and/or Dispose() on a Stream?

 

Published 11 December 04 11:01 by BradA
Filed under:

Comments

# Joshua Bair said on December 11, 2004 2:34 PM:
The site is down at the moment. What is the answer?!? :)

- Joshua
# Frederik said on December 11, 2004 2:35 PM:
Both, preferably, but Dispose() will close the stream as well and thus is 'required'.
# Matt said on December 11, 2004 2:37 PM:
Without consulting anything, aren't they both achieving the same end of disposing the stream resources? With .Close() just being more intuitive for people coming from various programming backgrounds. I'd be interested in knowing the reality, so someone correct my ignorance!
# William Robertson said on December 12, 2004 1:39 AM:
I say just place it in a using block and let the compiler deal with it. <grin>
# Raymond Lewallen said on December 13, 2004 6:28 AM:
Should probably call both, but Close() will call Dispose(), so Close() is the only one you really need to be calling.
# James Manning's blog said on December 19, 2004 11:11 AM:
# James Manning's blog said on December 19, 2004 11:11 AM:
New Comments to this post are disabled

Search

Go

This Blog

Syndication

Page view tracker