System.IO 命名空間

System.IO 命名空間 (Namespace) 包含允許讀取和寫入檔案和資料流的型別,以及提供基本檔案和目錄支援的型別。 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

以二進位方式將基本型別 (Primitive Type) 寫入資料流,並支援以特定編碼方式寫入字串。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

公開建立、移動和全面列舉目錄和子目錄的執行個體 (Instance) 方法。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

找到 Managed 組件但是無法載入時,所擲回的例外狀況。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

提供資料給目錄事件:ChangedCreatedDeletedProvides data for the directory events: Changed, Created, Deleted.

FileSystemInfo

FileInfoDirectoryInfo 物件提供基底類別。Provides the base class for both FileInfo and DirectoryInfo objects.

FileSystemWatcher

當目錄或目錄內的檔案變更時,接聽 (Listen) 檔案系統變更告知並引發事件。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

設定視覺化設計工具 (Visual Designer) 在參考事件、擴充項 (Extender) 或屬性時可以顯示的描述。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. 這是 abstract 類別。This is an abstract class.

StreamReader

實作以特定的編碼方式自位元組資料流讀取字元的 TextReaderImplements a TextReader that reads characters from a byte stream in a particular encoding.

StreamWriter

實作以特定的編碼方式將字元寫入位元組資料流的 TextWriterImplements a TextWriter for writing characters to a stream in a particular encoding.

StringReader

實作讀取字串的 TextReaderImplements 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

代表可以讀取一連串連續字元的讀取器 (Reader)。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

從 Managed 程式碼對 Unmanaged 記憶體區塊提供隨機存取。Provides random access to unmanaged blocks of memory from managed code.

UnmanagedMemoryStream

從 Managed 程式碼對 Unmanaged 記憶體區塊提供存取。Provides access to unmanaged blocks of memory from managed code.

WindowsRuntimeStorageExtensions

包含開發 Windows 市集應用程式時,用於 Windows 執行階段中 IStorageFileIStorageFolder 介面的擴充方法。Contains extension methods for the IStorageFile and IStorageFolder interfaces in the Windows Runtime when developing Windows Store apps.

WindowsRuntimeStreamExtensions

包含用於在 Windows 執行階段中之資料流與適用於 Windows 市集應用程式的 .NET 中之受控資料流之間轉換的擴充方法。Contains extension methods for converting between streams in the Windows Runtime and managed streams in the .NET for Windows Store apps.

結構

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

提供檔案和目錄的屬性 (Attribute)。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

表示將會處理 Error 物件的 FileSystemWatcher 事件的方法。Represents the method that will handle the Error event of a FileSystemWatcher object.

FileSystemEventHandler

表示處理 Changed 類別中 CreatedDeletedFileSystemWatcher 事件的方法。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.