System.Text Namespace

The System.Text namespace 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.

Remarks

The encoding classes are primarily intended to convert between different encodings or code pages and a Unicode encoding. System.Text.Encoding.Unicode (UTF-16) encoding is used internally by the .NET Framework, and System.Text.Encoding.UTF8 encoding is often used for storing character data to ensure portability across machines and cultures.

The classes derived from System.Text.Encoding enable you to choose a fallback strategy, which determines how characters that cannot be encoded into a sequence of bytes, or bytes that cannot be decoded into characters, are handled. You can choose one of the following:

The System.Text.StringBuilder class is designed for operations that perform extensive manipulations on a single string. Unlike the string class, the System.Text.StringBuilder class is mutable and provides better performance when concatenating or deleting strings.

For more information about System.Text, see Character Encoding in the .NET Framework and the MSDN blog tp://go.microsoft.com/fwlink/?LinkId=161021.

Classes

TypeReason
ASCIIEncoding

Represents an ASCII character encoding of Unicode characters.

Decoder

Converts a sequence of encoded bytes into a set of characters.

DecoderExceptionFallback

Throws System.Text.DecoderFallbackException if an encoded input byte sequence cannot be converted to a decoded output character. This class cannot be inherited.

DecoderExceptionFallbackBuffer

Throws System.Text.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

Throws a System.Text.EncoderFallbackException if an input character cannot be converted to an encoded output byte sequence. This class cannot be inherited.

EncoderExceptionFallbackBuffer

Throws System.Text.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.

EncodingInfo

Provides basic information about an encoding.

NormalizationForm

Defines the type of normalization to perform.

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.