C# System.IO Namespace

The System.IO namespace consists of IO related classes, structures, delegates and enumerations. These classes can be used to reads and write data to files or data streams. It also contains classes for file and directory support.

C# System.IO Namespace Classes

Following are the classes reside into System.IO namespace.

ClassDescription
BinaryReaderIt is used to read primitive data types as binary values in a specific encoding.
BinaryWriterIt is used to write primitive types in binary to a stream.
BufferedStreamIt is used to add a buffering layer to read and write operations on another stream. It is a sealed class.
DirectoryIt is used to expose static methods for creating, moving and enumerating through directories and subdirectories. It is a sealed class.
DirectoryInfoIt is used to expose instance methods for creating, moving and enumerating through directories and subdirectories. It is a sealed class.
DirectoryNotFoundExceptionIt is used to handle exception related to the file or directory cannot be found.
DriveInfoIt is used to access the information on a drive.
DriveNotFoundExceptionIt is used to handle drive not found exception.
EndOfStreamExceptionIt is used to handle end of stream exception.
ErrorEventArgsIt provides data for the FileSystemWatcher.Error event.
FileThis class provides static methods for the creation, copying, deletion, moving and opening of a single file.
FileFormatExceptionIt is used to handle file format exception.
FileInfoIt is used to provide properties and instance methods for the creation, copying, deletion, moving and opening of files.
FileLoadExceptionIt is used to handle file load exception.
FileNotFoundExceptionIt is used to handle file load exception.
FileNotFoundExceptionIt is used to handle file not found exception.
FileStreamIt provides a Stream for a file, supporting both synchronous and asynchronous read and write operations.
FileSystemEventArgsIt provides data for the directory events.
FileSystemInfoIt provides the base class for both FileInfo and DirectoryInfo objects.
FileSystemWatcherIt listens to the file system change notifications and raises events when a directory or file in a directory, changes.
InternalBufferOverflowExceptionThis class is used to handle internal buffer overflow exception.
InvalidDataExceptionIt is used to handle invalid data exception.
IODescriptionAttributeIt sets the description visual designers can display when referencing an event, extender or property.
IOExceptionIt is an exception class that handles I/O errors.
MemoryStreamIt is used to create a stream whose backing store is memory.
PathIt performs operations on String instances that contain file or directory path information.
PathTooLongExceptionIt is an exception class and used to handle path too long exception.
PipeExceptionThis exception class is used to handle pipe related exception.
RenamedEventArgsIt is used to provide data for the Renamed event.
StreamIt is used to provide a generic view of a sequence of bytes. It is an abstract class.
StreamReaderIt is used to implement a TextReader that reads characters from a byte stream.
StringReaderIt is used to implement a TextReader that reads from a string.
StringWriterIt is used to implement a TextWriter for writing information to a string. The information is stored in an underlying StringBuilder.
TextReaderThis class is used to represent a reader that can read a sequential series of characters.
TextWriterThis class is used to represent a writer that can write a sequential series of characters.
UnmanagedMemoryAccessorIt is used to provide random access to unmanaged blocks of memory from managed code.
UnmanagedMemoryStreamIt is used to get access to unmanaged blocks of memory from managed code.

System.IO Namespace Structures

Following are the structures reside into the System.IO Namespace.

StructureDescription
WaitForChangedResultIt contains information on the change that occurred.

System.IO Namespace Delegates

The System.IO Namespace contains the following delegates.

DelegatesDescription
ErrorEventHandlerIt represents the method that will handle the Error event of a FileSystemWatcher object.
FileSystemEventHandlerIt represents the method that will handle the Changed, Created or Deleted event of a FileSystemWatcher class.
RenamedEventHandlerIt represents the method that will handle the renamed event of a FileSystemWatcher class.

System.IO Namespace Enumerations

The following table contains the enumerations reside into the System.IO namespace.

EnumerationDescription
DriveTypeIt is used to define constants for drive types including CDRom, Fixed, Network etc.
FileAccessIt is used to define constants for read, write or read/write access to a file.
FileAttributesIt is used to provide attributes for files and directories.
FileModeIt is used to specify how the operating system should open a file.
FileOptionsIt is used to represents advanced options for creating a FileStream object.
FileShareIt is used to contain constants for controlling the kind of access other FileStream objects can have to the same file.
HandleInheritabilityIt specifies whether the underlying handle is inheritable by child processes.
NotifyFiltersIt is used to specify changes to watch for in a file or folder.
SearchOptionIt is used to specify whether to search the current directory or the current directory and all subdirectories.
SeekOriginIt is used to specify the position in a stream to use for seeking.
WatcherChangeTypesIt changes that might occur to a file or directory.

Next TopicC# Collections




Latest Courses