System.IO 命名空間
包含允許讀取和寫入檔案和資料流的型別,以及提供基本檔案和目錄支援的型別。 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 |
公開建立、移動和全面列舉目錄和子目錄的執行個體 (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 |
提供檔案和目錄列舉選項。Provides file and directory enumeration options. |
ErrorEventArgs | |
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 |
提供 Windows 特定的靜態擴充方法,用於操作檔案和目錄的存取控制清單 (ACL) 安全性屬性。Provides Windows-specific static extension methods for manipulating Access Control List (ACL) security attributes for files and directories. |
FileSystemEventArgs |
提供資料給目錄事件:Changed、Created、Deleted。Provides data for the directory events: Changed, Created, Deleted. |
FileSystemInfo |
為 FileInfo 和 DirectoryInfo 物件提供基底類別。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 | |
Stream |
提供位元組順序的一般觀點。Provides a generic view of a sequence of bytes. 這是 abstract 類別。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 |
代表可以讀取一連串連續字元的讀取器 (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 執行階段中 IStorageFile 與 IStorageFolder 介面的擴充方法。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 |
提供檔案和目錄的屬性。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 |
指定要比對的字元大小寫類型。Specifies the type of character casing to match. |
MatchType |
指定要使用的萬用字元比對類型。Specifies the type of wildcard matching to use. |
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 類別中 Created、Deleted 或 FileSystemWatcher 事件的方法。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. |