Classes Used in .NET Framework File I/O and the File System (Visual Basic)
Updated: July 20, 2015
For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
The following tables list the classes commonly used for .NET Framework file I/O, categorized into file I/O classes, classes used for creating streams, and classes used to read and write to streams.
To enter the .NET Framework 2.0 documentation and find a more comprehensive listing, see Class Library Overview.
The following table lists and describes the main classes used for file I/O.
|System.IO.Directory||Provides static methods for creating, moving, and enumerating through directories and subdirectories.|
|System.IO.DirectoryInfo||Provides instance methods for creating, moving, and enumerating through directories and subdirectories.|
|System.IO.DriveInfo||Provides instance methods for creating, moving, and enumerating through drives.|
|System.IO.File||Provides static methods for creating, copying, deleting, moving, and opening files, and aids in the creation of a |
|System.IO.FileAccess||Defines constants for read, write, or read/write access to a file.|
|System.IO.FileAttributes||Provides attributes for files and directories such as |
|System.IO.FileInfo||Provides static methods for creating, copying, deleting, moving, and opening files, and aids in the creation of a |
|System.IO.FileMode||Controls how a file is opened. This parameter is specified in many of the constructors for |
|System.IO.FileShare||Defines constants for controlling the type of access other file streams can have to the same file.|
|System.IO.Path||Provides methods and properties for processing directory strings.|
|System.Security.Permissions.FileIOPermission||Controls the access of files and folders by defining Read, Write, Append and PathDiscovery permissions.|
The following table lists and describes the main classes used to create streams.
|System.IO.BufferedStream||Adds a buffering layer to read and write operations on another stream.|
|System.IO.FileStream||Supports random access to files through its Seek method. FileStream opens files synchronously by default but also supports asynchronous operation.|
|System.IO.MemoryStream||Creates a stream whose backing store is memory, rather than a file.|
|System.Net.Sockets.NetworkStream||Provides the underlying stream of data for network access.|
|System.Security.Cryptography.CryptoStream||Defines a stream that links data streams to cryptographic transformations.|
The following table shows the specific classes used for reading from and writing to files with streams.
|System.IO.BinaryReader||Reads encoded strings and primitive data types from a FileStream.|
|System.IO.BinaryWriter||Writes encoded strings and primitive data types to a FileStream.|
|System.IO.StreamReader||Reads characters from a FileStream, using CurrentEncoding to convert characters to and from bytes. StreamReader has a constructor that attempts to ascertain the correct CurrentEncoding for a given stream, based on the presence of a CurrentEncoding-specific preamble, such as a byte order mark.|
|System.IO.StreamWriter||Writes characters to a |
|System.IO.StringReader||Reads characters from a |
|System.IO.StringWriter||Writes characters to a |