System.IO Namespace

System.IO 命名空间包含允许读写文件和数据流的类型以及提供基本文件和目录支持的类型。 The System.IO namespace contains types that allow reading and writing to files and data streams, and types that provide basic file and directory support.

BinaryReader

用特定的编码将基元数据类型读作二进制值。 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.

BufferedStream

将缓冲层添加到另一个流上的读取和写入操作。 Adds a buffering layer to read and write operations on another stream. 此类不能被继承。 This class cannot be inherited.

Directory

公开用于通过目录和子目录进行创建、移动和枚举的静态方法。 Exposes static methods for creating, moving, and enumerating through directories and subdirectories. 此类不能被继承。 This class cannot be inherited.

DirectoryInfo

公开用于通过目录和子目录进行创建、移动和枚举的实例方法。 Exposes instance methods for creating, moving, and enumerating through directories and subdirectories. 此类不能被继承。 This class cannot be inherited.

DirectoryNotFoundException

找不到文件或目录的部件时引发的异常。 The exception that is thrown when part of a file or directory cannot be found.

DriveInfo

提供对有关驱动器的信息的访问。 Provides access to information on a drive.

DriveNotFoundException

当尝试访问的驱动器或共享不可用时引发的异常。 The exception that is thrown when trying to access a drive or share that is not available.

EndOfStreamException

尝试在流末尾之后读取时引发的异常。 The exception that is thrown when reading is attempted past the end of a stream.

EnumerationOptions
ErrorEventArgs

Error 事件提供数据。 Provides data for the Error event.

File

提供用于创建、复制、删除、移动和打开单一文件的静态方法,并协助创建 FileStream 对象。 Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of FileStream objects.

FileFormatException

应该符合一定文件格式规范的输入文件或数据流的格式不正确时引发的异常。 The exception that is thrown when an input file or a data stream that is supposed to conform to a certain file format specification is malformed.

FileInfo

提供用于创建、复制、删除、移动和打开文件的属性和实例方法,并且帮助创建 FileStream 对象。 Provides properties and 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.

FileLoadException

当找到托管程序集却不能加载它时引发的异常。 The exception that is thrown when a managed assembly is found but cannot be loaded.

FileNotFoundException

尝试访问磁盘上不存在的文件失败时引发的异常。 The exception that is thrown when an attempt to access a file that does not exist on disk fails.

FileStream

为文件提供 Stream,既支持同步读写操作,也支持异步读写操作。 Provides a Stream for a file, supporting both synchronous and asynchronous read and write operations.

FileSystemAclExtensions
FileSystemEventArgs

提供目录事件的数据:ChangedCreatedDeleted Provides data for the directory events: Changed, Created, Deleted.

FileSystemInfo

FileInfoDirectoryInfo 对象提供基类。 Provides the base class for both FileInfo and DirectoryInfo objects.

FileSystemWatcher

侦听文件系统更改通知,并在目录或目录中的文件发生更改时引发事件。 Listens to the file system change notifications and raises events when a directory, or file in a directory, changes.

InternalBufferOverflowException

内部缓冲区溢出时引发的异常。 The exception thrown when the internal buffer overflows.

InvalidDataException

数据流格式无效时引发的异常。 The exception that is thrown when a data stream is in an invalid format.

IODescriptionAttribute

设置可视化设计器在引用事件、扩展程序或属性时可显示的说明。 Sets the description visual designers can display when referencing an event, extender, or property.

IOException

发生 I/O 错误时引发的异常。 The exception that is thrown when an I/O error occurs.

MemoryStream

创建一个流,其后备存储为内存。 Creates a stream whose backing store is memory.

Path

对包含文件或目录路径信息的 String 实例执行操作。 Performs operations on String instances that contain file or directory path information. 这些操作是以跨平台的方式执行的。 These operations are performed in a cross-platform manner.

PathTooLongException

当路径名或完全限定的文件名长度超过系统定义的最大长度时引发的异常。 The exception that is thrown when a path or fully qualified file name is longer than the system-defined maximum length.

PipeException

当命名管道内出现错误时引发。 Thrown when an error occurs within a named pipe.

RenamedEventArgs

Renamed 事件提供数据。 Provides data for the Renamed event.

Stream

提供字节序列的一般视图。 Provides a generic view of a sequence of bytes. 这是一个抽象类。 This is an abstract class.

StreamReader

实现一个 TextReader,使其以一种特定的编码从字节流中读取字符。 Implements a TextReader that reads characters from a byte stream in a particular encoding.

StreamWriter

实现一个 TextWriter,使其以一种特定的编码向流中写入字符。 Implements a TextWriter for writing characters to a stream in a particular encoding.

StringReader

实现从字符串进行读取的 TextReader Implements a TextReader that reads from a string.

StringWriter

实现一个用于将信息写入字符串的 TextWriter Implements a TextWriter for writing information to a string. 该信息存储在基础 StringBuilder 中。 The information is stored in an underlying StringBuilder.

TextReader

表示可读取有序字符系列的读取器。 Represents a reader that can read a sequential series of characters.

TextWriter

表示可以编写一个有序字符系列的编写器。 Represents a writer that can write a sequential series of characters. 此类为抽象类。 This class is abstract.

UnmanagedMemoryAccessor

提供从托管代码随机访问非托管内存块的能力。 Provides random access to unmanaged blocks of memory from managed code.

UnmanagedMemoryStream

提供从托管代码访问非托管内存块的能力。 Provides access to unmanaged blocks of memory from managed code.

结构

WaitForChangedResult

包含发生的更改信息。 Contains information on the change that occurred.

枚举

DriveType

定义驱动器类型常数,包括 CDRom、Fixed、Network、NoRootDirectory、Ram、Removable 和 Unknown。 Defines constants for drive types, including CDRom, Fixed, Network, NoRootDirectory, Ram, Removable, and Unknown.

FileAccess

定义文件的读取、写入或读/写访问权限的常量。 Defines constants for read, write, or read/write access to a file.

FileAttributes

提供文件和目录的属性。 Provides attributes for files and directories.

FileMode

指定操作系统打开文件的方式。 Specifies how the operating system should open a file.

FileOptions

表示用于创建 FileStream 对象的高级选项。 Represents advanced options for creating a FileStream object.

FileShare

包含用于控制其他 FileStream 对象对同一文件可以具有的访问类型的常数。 Contains constants for controlling the kind of access other FileStream objects can have to the same file.

HandleInheritability

指定基础句柄是否已由子进程继承。 Specifies whether the underlying handle is inheritable by child processes.

MatchCasing
MatchType
NotifyFilters

指定要在文件或文件夹中监视的更改。 Specifies changes to watch for in a file or folder.

SearchOption

指定是搜索当前目录,还是搜索当前目录及其所有子目录。 Specifies whether to search the current directory, or the current directory and all subdirectories.

SeekOrigin

指定流中的位置以供查找使用。 Specifies the position in a stream to use for seeking.

WatcherChangeTypes

可能会发生的文件或目录的更改。 Changes that might occur to a file or directory.

委托

ErrorEventHandler

表示将处理 FileSystemWatcher 对象的 Error 事件的方法。 Represents the method that will handle the Error event of a FileSystemWatcher object.

FileSystemEventHandler

表示将处理 FileSystemWatcher 类的 ChangedCreatedDeleted 事件的方法。 Represents the method that will handle the Changed, Created, or Deleted event of a FileSystemWatcher class.

RenamedEventHandler

表示将处理 Renamed 类的 FileSystemWatcher 事件的方法。 Represents the method that will handle the Renamed event of a FileSystemWatcher class.