c# - What's the socially acceptable way to leave a Stream after using it? -
if designing api, or within own code, , method accepts stream
, method's duty check position , reset beginning provided canseek
true
before using it?
if so, why isn't there method on stream
class itself?
over years i've been caught out few times assuming stream
comes method in position 0.
and right reset stream
possible after using it?
alternatively, should stream
s copied around instead of passed around directly? seems bit excessive me.
is method's duty check position , reset beginning provided canseek true before using it?
no, in case expect calling code prepare stream correctly.
the common patterns share stream on methods require pointer left after last read/write, never comes much.
but best thing after using it: nothing.
Comments
Post a Comment