Are streams any better than byte array outside of I.O context?

Streams are visibly better when working with files, network responses and many other cases, but, when specifically working with objects which already live within RAM memory, are streams still useful? I.E why does Binary Formatter used streams when formatting managed objects? The understanding that I have from streams is a lot like IEnumerable<byte> with a temp buffer, meaning, nothing happens upon creation until fetched. Maybe postpone an action till last moment?
3 Replies
Jimmacle
Jimmacle3mo ago
they're still useful if you want to treat the bytes like a stream of data (also don't use binaryformatter)
𝗝𝗮𝗺𝗲𝘀
to treat the bytes like a stream of data
What does this mean? A stream-like is a sequence with a declared 'current position'?
Jimmacle
Jimmacle3mo ago
basically it's also advantageous to use a stream if you can because then the API isn't limited to working with in-memory data