System.Text Namespace
Provides fundamental classes that represent ASCII and Unicode characters and strings, and classes that read and write sequences of characters.
Search in System.Text
Classes
StringBuilder
Represents a mutable sequence of characters.
System.Text.StringBuilder
Remarks
The StringBuilder class is used when you need to perform multiple modifications to a string.
When you use the + or += operators to append to a string, a new string object
is created with the appended content. With a large number of append operations, this can consume
a significant amount of memory and degrade performance. The StringBuilder class
optimizes for these scenarios by allocating a buffer and appending characters to it.
Encoding
Represents a character encoding.
System.Text.Encoding
Remarks
The Encoding class is an abstract base class that represents a character encoding.
It provides methods for converting character sequences to byte sequences and vice versa.
Concrete classes derived from Encoding, such as UTF8Encoding,
ASCIIEncoding, and UnicodeEncoding, represent specific encodings.
ASCIIEncoding
Represents the ASCII character encoding.
System.Text.ASCIIEncoding
Remarks
The ASCII encoding uses 7 bits to represent characters, supporting 128 characters. It is a subset of the Unicode character set and is commonly used for legacy systems or when interoperability with ASCII-based systems is required.
UTF8Encoding
Represents the UTF-8 character encoding.
System.Text.UTF8Encoding
Remarks
UTF-8 is a variable-width character encoding capable of encoding all possible Unicode characters. It is the most widely used encoding on the World Wide Web.
Structs
Rune
Represents a single Unicode character.
System.Text.Rune
Remarks
The Rune struct represents a single Unicode scalar value. This is useful for
working with characters that might be represented by surrogate pairs in UTF-16.
Enums
DecoderFallbackBehavior
Specifies how a decoder should behave when it encounters an invalid sequence of bytes.
System.Text.DecoderFallbackBehavior
EncoderFallbackBehavior
Specifies how an encoder should behave when it encounters a character that cannot be encoded.
System.Text.EncoderFallbackBehavior