C# System.IO Namespace

In c#, System.IO is a namespace. It will contain standard IO (input/output) types such as classes, structures, enumerations, and delegates to perform read/write operations on different sources like file, memory, network, etc.

C# System.IO Classes

The following are the different classes in the System.IO namespace to perform various operations like creating files, writing to files, reading from files, etc.

 

ClassDescription
BinaryReader This class is useful to read primitive data types from a binary stream.
BinaryWriter It is useful to write primitive types in binary format.
BufferedStream This class is useful for reading and writing bytes from other streams.
Directory This class provides methods to manipulate the directories and subdirectories like to create, move, etc.
File This class provides methods to manipulate the files like create, copy, delete, move and open a file.
FileStream This class is useful to read or write bytes from/to a file.
MemoryStream This class is useful for reading or writing bytes stored in memory.
Path This class is useful to perform operations on directory path information.
Stream This class is an abstract class, and it will provide methods to transfer bytes to the source.
StreamReader This class is useful to read characters from stream by converting bytes into characters using an encoded value.
StreamWriter This class is useful to write characters to stream by converting characters into bytes using an encoded value.
StringReader This class is useful to read from a string.
StringWriter This class is useful for writing information to string.
TextReader This class is useful for reading a sequential series of characters.
TextWriter This class is abstract, and it is useful to write a sequential series of characters.

C# System.IO Structures

Following are the different type of structures that exists in the System.IO namespace.

 

StructureDescription
WaitForChangedResult This structure will contain information on the change that occurred.

C# System.IO Enumerations

Following are the different type of enumerations that exists in the System.IO namespace.

 

EnumerationDescription
DriveType This will define constants for drive types.
FileAccess It defines constants for reading, writing, or read/write access to a file.
FileAttributes It provides attributes for files and directories.
FileMode It will specify how an operating system will open the file.
FileOptions It will provide advanced options for creating a filestream object.
FileShare It will contain constants to control the access of filestream objects.
HandleInheritability It is useful to specify whether the underlying handle is inheritable by child processes.
NotifyFilters It will specify the changes to watch for in a file or folder.
SearchOption It will specify whether to search the current directory or the current directory and all subdirectories.
SeekOrigin It will specify the position in a stream to use for seeking.
WatcherChangeTypes It will specify the changes that might occur to a file or directory.

C# System.IO Delegates

Following are the different type of delegates that exists in the System.IO namespace.

 

DelegateDescription
ErrorEventHandler This will represent a method that will handle the error event of a FileSystemWatcher object.
FileSystemEventHandler It will represent a method that will handle the changed, created, or deleted event of a FileSystemWatcher class.
RenamedEventHandler It will represent a method that will handle the renamed event of a FileSystemWatcher class.

This is how the System.IO namespace contains different types to perform read/write operations on various sources like file, memory, network, etc.