15.1. Streams

C#'s core I/O classes and interfaces are defined in the System.IO namespace. The System.IO.Stream class is an abstract class that abstracts out the concept of a stream as merely a sequence of bytes. A stream can be read from or written to synchronously or asynchronously depending on the method call you use. A stream of bytes is usually associated with the underlying medium on which I/O operations such as a read/write are carried out. The medium can be an I/O device, a disk file, memory, or a TCP/IP socket. Java has a similar concept of streams (java.io.InputStream and java.io.OutputStream). The C# System.IO.Stream class is somewhat equivalent to the Java classes, although it does not have separate classes for reading and writing; ...

Get .NET for Java Developers: Migrating to C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.