C# System.IO Namespace
The IO related classes, structures, delegates, and enumerations in C# along with the classes for file and directory support are included in the System.IO namespace. For reading and writing data to files or data streams, the IO related classes can be used.
C# System.IO Namespace Classes:
The classes residing inside the System.IO namespace are listed below.
Class | Uses |
BinaryReader | For reading primitive data types as binary values in a specific encoding. |
BinaryWriter | For writing primitive types in binary to a stream. |
BufferedStream | For adding a buffering layer to read and write operations on another stream. It is a sealed class. |
Directory | For exposing the static methods for creating, moving and enumerating through directories and subdirectories. It is a sealed class. |
DirectoryInfo | For exposing the instance methods for creating, moving and enumerating through directories and subdirectories. It is a sealed class. |
DirectoryNotFoundException | For handling the exception related to the file or directory that cannot be found. |
DriveInfo | For accessing the information on a drive. |
DriveNotFoundException | For handling the drive not found exception. |
EndOfStreamException | For handling the end of stream exception. |
ErrorEventArgs | For facilitating the data for the FileSystemWatcher.Error event. |
File | For facilitating the static methods for the creation, copying, deletion, moving and opening of a single file. |
FileFormatException | For handling the file format exception. |
FileInfo | For facilitating the properties and instance methods for the creation, copying, deletion, moving and opening of files. |
FileLoadException | For handling the file load exception. |
FileNotFoundException | For handling the file load exception. |
FileNotFoundException | For handling the file not found exception. |
FileStream | For facilitating a Stream for a file, supporting both synchronous and asynchronous read and write operations. |
FileSystemEventArgs | For facilitating the data for the directory events. |
FileSystemInfo | For facilitating the base class for both FileInfo and DirectoryInfo objects. |
FileSystemWatcher | For listening to the file system change notifications and for raising events when a directory or file in a directory changes. |
InternalBufferOverflowException | For handling the internal buffer overflow exception. |
InvalidDataException | For handling the invalid data exception. |
IODescriptionAttribute | To set the description visual designers to display while referencing an event, extender or property. |
IOException | For handling the I/O errors. It is an exception class. |
MemoryStream | For creating a stream whose backing store is memory. |
Path | For performing the operations on String instances that contain file or directory path information. |
PathTooLongException | For handling the path too long exception. It is an exception class. |
PipeException | For handling the pipe related exception. It is an exception class. |
RenamedEventArgs | For facilitating the data for the Renamed event. |
Stream | For facilitating a generic view of a sequence of bytes. It is an abstract class. |
StreamReader | For implementing a TextReader to read characters from a byte stream. |
StringReader | For implementing a TextReader to read from a string. |
StringWriter | For implementing a TextWriter for writing information to a string that is saved in an underlying StringBuilder. |
TextReader | For representing a reader to read a sequential series of characters. |
TextWriter | For representing a writer to write a sequential series of characters. |
UnmanagedMemoryAccessor | For facilitating the random access to unmanaged blocks of memory from managed code. |
UnmanagedMemoryStream | For facilitating the access to unmanaged blocks of memory from managed code. |
System.IO Namespace Structures:
The structures residing inside the System.IO namespace are listed below.
Structure | Uses |
WaitForChangedResult | To contain the information about the change that occurred. |
System.IO Namespace Delegates:
The delegates residing inside the System.IO namespace are listed below.
Delegates | Uses |
ErrorEventHandler | To specify the method for handling the Error event of a FileSystemWatcher object. |
FileSystemEventHandler | To specify the method for handling the Changed, Created or Deleted event of a FileSystemWatcher class. |
RenamedEventHandler | To specify the method for handling the renamed event of a FileSystemWatcher class. |
System.IO Namespace Enumerations:
The enumerations residing inside the System.IO namespace are listed below.
Enumeration | Uses |
DriveType | To specify the constants for drive types including CDRom, Fixed, Network etc. |
FileAccess | To specify the constants for read, write or read/write access to a file. |
FileAttributes | To facilitating the attributes for files and directories. |
FileMode | To define the way to open a file by the operating system. |
FileOptions | To specify the advanced options to create a FileStream object. |
FileShare | To add constants to control the kind of access other FileStream objects can have to the same file. |
HandleInheritability | To determine whether the underlying handle is inheritable by child processes. |
NotifyFilters | To define the changes to watch for in a file or folder. |
SearchOption | To determine whether to search the current directory or the current directory and all subdirectories. |
SeekOrigin | To define the position in a stream to use for seeking. |
WatcherChangeTypes | To specify the changes that might occur to a file or directory. |