0% found this document useful (0 votes)
20 views

File Handling

The document discusses the System.IO namespace in .NET, which provides classes and methods for reading and writing files and data streams. It describes common classes like File, FileInfo, Directory, StreamReader, and FileSystemWatcher. It also covers related enumerations like FileAccess, FileShare, and DriveType.

Uploaded by

Alejandro Sotelo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

File Handling

The document discusses the System.IO namespace in .NET, which provides classes and methods for reading and writing files and data streams. It describes common classes like File, FileInfo, Directory, StreamReader, and FileSystemWatcher. It also covers related enumerations like FileAccess, FileShare, and DriveType.

Uploaded by

Alejandro Sotelo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

System.

IO Namespace is a collection of classes, methods, enumeration and types that is


responsible for reading and writing files and data streams. All the File Handling operations
require System.IO namespace.

CLASSES

Class Description

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.

To browse the .NET Framework source


code for this type, see the Reference
Source.

DirectoryInfo Exposes instance methods for creating,


moving, and enumerating through
directories and subdirectories. This class
cannot be inherited.

To browse the .NET Framework source


code for this type, see the Reference
Source.

DirectoryNotFoundExcept The exception that is thrown when part


ion 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.

ErrorEventArgs Provides data for


the FileSystemWatcher.Error event.

File Provides static methods for the creation,


copying, deletion, moving, and opening of
a single file, and aids in the creation
of FileStream objects.

To browse the .NET Framework source


code for this type, see the Reference
Source.

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 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.

To browse the .NET Framework source


code for this type, see the Reference
Source.

FileLoadException 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 Provides a Stream for a file, supporting
both synchronous and asynchronous
read and write operations.

To browse the .NET Framework source


code for this type, see the Reference
Source.

FileSystemEventArgs Provides data for the directory


events: Changed, Created, Deleted.

FileSystemInfo Provides the base class for


both FileInfo and DirectoryInfo objects
.

FileSystemWatcher Listens to the file system change


notifications and raises events when a
directory, or file in a directory, changes.

To browse the .NET Framework source


code for this type, see the Reference
Source.

InternalBufferOverflowEx The exception thrown when the internal


ception buffer overflows.

InvalidDataException The exception that is thrown when a


data stream is in an invalid format.

IODescriptionAttribute Sets the description visual designers can


display when referencing an event,
extender, or property.

IOException The exception that is thrown when an I/O


error occurs.

MemoryStream Creates a stream whose backing store is


memory.

To browse the .NET Framework source


code for this type, see the Reference
Source.
Path Performs operations on String instances
that contain file or directory path
information. These operations are
performed in a cross-platform manner.

To browse the .NET Framework source


code for this type, see the Reference
Source.

PathTooLongException The exception that is thrown when a


path or file name is longer than the
system-defined maximum length.

PipeException Thrown when an error occurs within a


named pipe.

RenamedEventArgs Provides data for the Renamed event.

Stream Provides a generic view of a sequence of


bytes. This is an abstract class.

To browse the .NET Framework source


code for this type, see the Reference
Source.

StreamReader Implements a TextReader that reads


characters from a byte stream in a
particular encoding.

To browse the .NET Framework source


code for this type, see the Reference
Source.

StreamWriter Implements a TextWriter for writing


characters to a stream in a particular
encoding.

To browse the .NET Framework source


code for this type, see the Reference
Source.

StringReader Implements a TextReader that reads


from a string.

StringWriter Implements a TextWriter for writing


information to a string. The information
is stored in an underlyingStringBuilder.

TextReader 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.

UnmanagedMemoryAcces Provides random access to unmanaged


sor blocks of memory from managed code.

UnmanagedMemoryStrea Provides access to unmanaged blocks of


m memory from managed code.

ENUMERATIONS

Enumeration Description

DriveType 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 Represents advanced options for creating


a FileStream object.

FileShare Contains constants for controlling the kind of


access other FileStream objects can have to
the same file.

HandleInheritabili Specifies whether the underlying handle is


ty inheritable by child processes.

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.

WatcherChangeT Changes that might occur to a file or directory.


ypes

System.Text Namespace
Classes
Structs
Enums
Remarks
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for
converting blocks of characters to and from blocks of bytes; and a helper class that manipulates
and formats String objects without creating intermediate instances of String.
Classes
Expand table

Ascii

ASCIIEncoding Represents an ASCII character encoding of


Unicode characters.

CodePagesEncodingProvider Provides access to an encoding provider for code


pages that otherwise are available only in the
desktop .NET Framework.

CompositeFormat Represents a parsed composite format string.

Decoder Converts a sequence of encoded bytes into a set


of characters.

DecoderExceptionFallback Provides a failure-handling mechanism, called a


fallback, for an encoded input byte sequence that
cannot be converted to an input character. The
fallback throws an exception instead of decoding
the input byte sequence. This class cannot be
inherited.

DecoderExceptionFallbackBuffer Throws DecoderFallbackException when an


encoded input byte sequence cannot be
converted to a decoded output character. This
class cannot be inherited.

DecoderFallback Provides a failure-handling mechanism, called a


fallback, for an encoded input byte sequence that
cannot be converted to an output character.

DecoderFallbackBuffer Provides a buffer that allows a fallback handler


to return an alternate string to a decoder when it
cannot decode an input byte sequence.

DecoderFallbackException The exception that is thrown when a decoder


fallback operation fails. This class cannot be
inherited.

DecoderReplacementFallback Provides a failure-handling mechanism, called a


fallback, for an encoded input byte sequence that
cannot be converted to an output character. The
fallback emits a user-specified replacement
string instead of a decoded input byte sequence.
This class cannot be inherited.

DecoderReplacementFallbackBuffer Represents a substitute output string that is


emitted when the original input byte sequence
cannot be decoded. This class cannot be
inherited.

Encoder Converts a set of characters into a sequence of


bytes.

EncoderExceptionFallback Provides a failure-handling mechanism, called a


fallback, for an input character that cannot be
converted to an output byte sequence. The
fallback throws an exception if an input
character cannot be converted to an output byte
sequence. This class cannot be inherited.

EncoderExceptionFallbackBuffer Throws EncoderFallbackException when an


input character cannot be converted to an
encoded output byte sequence. This class cannot
be inherited.

EncoderFallback Provides a failure-handling mechanism, called a


fallback, for an input character that cannot be
converted to an encoded output byte sequence.

EncoderFallbackBuffer Provides a buffer that allows a fallback handler


to return an alternate string to an encoder when it
cannot encode an input character.

EncoderFallbackException The exception that is thrown when an encoder


fallback operation fails. This class cannot be
inherited.

EncoderReplacementFallback Provides a failure handling mechanism, called a


fallback, for an input character that cannot be
converted to an output byte sequence. The
fallback uses a user-specified replacement string
instead of the original input character. This class
cannot be inherited.

EncoderReplacementFallbackBuffer Represents a substitute input string that is used


when the original input character cannot be
encoded. This class cannot be inherited.

Encoding Represents a character encoding.

EncodingExtensions Provides extension methods for the encoding


types, such as Encoding, Encoder, and Decoder.

EncodingInfo Provides basic information about an encoding.

EncodingProvider Provides the base class for an encoding provider,


which supplies encodings that are unavailable on
a particular platform.

StringBuilder Represents a mutable string of characters. This


class cannot be inherited.

UnicodeEncoding Represents a UTF-16 encoding of Unicode


characters.

UTF32Encoding Represents a UTF-32 encoding of Unicode


characters.

UTF7Encoding Represents a UTF-7 encoding of Unicode


characters.

UTF8Encoding Represents a UTF-8 encoding of Unicode


characters.

Structs
Expand table

Rune Represents a Unicode scalar value


([ U+0000..U+D7FF ], inclusive; or [
U+E000..U+10FFFF ], inclusive).

SpanLineEnumerator Enumerates the lines of


a ReadOnlySpan<T>.

SpanRuneEnumerator Provides an enumerator for


the Rune values represented by a
span containing UTF-16 text.

StringBuilder.AppendInterpolatedStringHandler Provides a handler used by the


language compiler to append
interpolated strings
into StringBuilder instances.
StringBuilder.ChunkEnumerator Supports simple iteration over the
chunks of a StringBuilder instance.

StringRuneEnumerator Provides an enumerator for


the Rune values represented by a
string.

Enums
Expand table

NormalizationForm Defines the type of normalization to perform.

You might also like