Stream classes

  • Thread starter Thread starter Zeba
  • Start date Start date
Z

Zeba

Hey,

Could anyone tell me how far the Stream classes of .net are actually
used in actual develpment scenarios ? Or do people mostly just need to
use databases to write data ?

THanks !!
 
Could anyone tell me how far the Stream classes of .net are actually
used in actual develpment scenarios ? Or do people mostly just need to
use databases to write data ?

No, streams are vital all over the place - reading/writing data with
files and with network connections being the most common uses in my
experience.

Jon
 
Further - for BLOB manipulation, database streams can come into play
(just to counter your "just need to use databases" point).

Another biggie would be compression; very convenient via streams; a
pain otherwise.

Serialization works via streams, and that is a common theme in many
scenarios (albeit often wrapped via XmlReader/XmlWriter).

I guess how much you use them depends on what you tend to do; if you
are just throwing some aspx pages together then you probably won't see
them much; if you are writing a comms / security layer you'll see them
lots.

Marc
 
And while streams are not necessarily needed for things like reading
from the files, or a socket (I'm surprized no one picked up on this), it is
very, very convenient to have these things represented in a ubiquitous,
unified model.

For example, if you extend a WebRequest/WebResponse class, you have to
override the GetRequestStream method. The beauty of this abstraction in
returning a Stream is that the Stream can be any derivation you want, so it
doesn't have to necessarily be network related. As long as you stick to the
model of what a Stream is, you are fine, which allows for a deep level of
customization.

This is really true about abstract classes and interfaces in general,
when they are designed properly, and you stick to the meaning of the
contract (not the implementation), you gain incredible flexibility.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top