System.IO Namespace
Namespace: System.IO
Provides types that allow reading and writing files and data streams, and types that represent and manage file system entries.
Directory Class
static class Directory
Provides static methods for the creation, moving, and enumeration of directories and subdirectories.
CreateDirectory(string path)
Delete(string path, bool recursive)
Exists(string path)
GetFiles(string path)
GetDirectories(string path)
Move(string sourceDirName, string destDirName)
File Class
static class File
Provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream
objects.
Create(string path)
Open(string path, FileMode mode)
OpenRead(string path)
OpenWrite(string path)
Exists(string path)
Copy(string sourceFileName, string destFileName, bool overwrite)
Delete(string path)
Move(string sourceFileName, string destFileName)
FileStream Class
sealed class FileStream : Stream
Exposes a Stream
around a file, supporting both synchronous and asynchronous read and write operations.
FileStream(string path, FileMode mode)
FileStream(string path, FileMode mode, FileAccess access)
ReadByte()
WriteByte(byte value)
Seek(long offset, SeekOrigin origin)
Flush()
Close()
StreamReader Class
sealed class StreamReader : TextReader
Implements a TextReader
that reads characters from a byte stream in a particular encoding.
StreamReader(Stream stream)
StreamReader(string path)
ReadToEnd()
ReadLine()
Peek()
Dispose()
StreamWriter Class
sealed class StreamWriter : TextWriter
Implements a TextWriter
for writing characters to a stream in a particular encoding.
StreamWriter(Stream stream)
StreamWriter(string path)
Write(string value)
WriteLine(string value)
Flush()
Dispose()
Path Class
static class Path
Contains static
members for processing directory and file path strings. This class cannot be inherited.
Combine(params string[] paths)
GetFileName(string path)
GetDirectoryName(string path)
GetExtension(string path)
GetFullPath(string path)
HasExtension(string path)