Freigeben über


System.IO Namespace

Microsoft Silverlight will reach end of support after October 2021. Learn more.

The System.IO namespace contains enumerations for file modes, file access, file sharing, and classes for path operations and manipulating streams. Silverlight-based applications do not use the file system of the operating system and are restricted to using isolated storage to persist and access files, so this namespace does not provide any additional functionality. For more information about how Silverlight-based applications use isolated storage, see Isolated Storage.

Classes

  Class Description
Public class BinaryReader Reads primitive data types as binary values in a specific encoding.
Public class BinaryWriter Writes primitive types in binary to a stream and supports writing strings in a specific encoding.
Public class Directory Exposes static methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
Public class DirectoryInfo Exposes instance methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
Public class DirectoryNotFoundException Infrastructure. The exception that is thrown when part of a file or directory cannot be found.
Public class EndOfStreamException The exception that is thrown when reading is attempted past the end of a stream.
Public class File Provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects.
Public class FileInfo Provides instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects. This class cannot be inherited.
Public class FileLoadException The exception that is thrown when a managed assembly is found but cannot be loaded.
Public class FileNotFoundException The exception that is thrown when an attempt to access a file that does not exist fails.
Public class FileStream When it is called by an elevated-trust application, exposes a Stream around a file, supporting both synchronous and asynchronous read and write operations.
Public class FileSystemInfo Provides the base class for both FileInfo and DirectoryInfo objects.
Public class IOException The exception that is thrown when an I/O error occurs.
Public class MemoryStream Creates a stream whose backing store is memory.
Public class Path Performs operations on String instances that contain file or directory path information. These operations are performed in a cross-platform manner.
Public class PathTooLongException The exception that is thrown when a pathname or filename is longer than the system-defined maximum length.
Public class Stream Provides a generic view of a sequence of bytes.
Public class StreamReader Implements a TextReader that reads characters from a byte stream in a particular encoding.
Public class StreamWriter Implements a TextWriter for writing characters to a stream in a particular encoding.
Public class StringReader Implements a TextReader that reads from a string.
Public class StringWriter Implements a TextWriter for writing information to a string. The information is stored in an underlying StringBuilder.
Public class TextReader Represents a reader that can read a sequential series of characters.
Public class TextWriter Represents a writer that can write a sequential series of characters. This class is abstract.
Public class UnmanagedMemoryStream Infrastructure. Provides access to unmanaged blocks of memory from managed code.

Enumerations

  Enumeration Description
Public enumeration FileAccess Defines constants for read, write, or read/write access to a file.
Public enumeration FileAttributes Provides attributes for files and directories.
Public enumeration FileMode Specifies how the operating system should open a file.
Public enumeration FileShare Contains constants for controlling the kind of access other IsolatedStorageFileStream objects can have to the same file.
Public enumeration SearchOption Specifies whether to search the current directory, or the current directory and all subdirectories.
Public enumeration SeekOrigin Provides the fields that represent reference points in streams for seeking.