
Files & Streams
Chapter 8
Ebook: Beginning Visual C# 2010, chapter 21
Reference: C# How to Program, chapter 17

Contents
Files and Streams overview
IO namespace and its classes
Serialization

Files and Streams
Files and Streams
C# views each file as a sequential stream of bytes
each file ends either with:
an end-of-file marker
specific byte number
recorded in a system-maintained administrative data structure
When a file is opened, an object is created and a stream is
associated with the object when a file is opened
two types of streams
output
input

Contents
Files and Streams
IO namespace and its classes
Serialization

IO namespace and its classes
Class Description
Stream Provides a view of the sequence of bytes
File Provides static methods for creating and manipulating files
FileSystemIn
fo
Contains methods that are common to file and directory
manipulation
Directory Provides methods for creating, moving and enumerating
through directories and sub-directories
DirectoryInfo Provides instance methods for creating, moving and
enumerating directories and sub-directories
TextReader Represents a reader that can read a sequence of
characters
TextWriter Represents a writer that can write a sequence of
characters
BinaryReade
r
Reads primitive data types as binary values in a specific
encoding
BinaryWriter Writes primitive types in binary to a stream and supports
writing strings in a specific encoding

