EncodingExtensions.GetChars Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

GetChars(Encoding, ReadOnlySequence<Byte>, IBufferWriter<Char>)

Decodes the specified ReadOnlySequence<T> to chars using the specified Encoding and writes the result to writer.

GetChars(Encoding, ReadOnlySequence<Byte>, Span<Char>)

Decodes the specified ReadOnlySequence<T> to chars using the specified Encoding and outputs the result to chars.

GetChars(Encoding, ReadOnlySpan<Byte>, IBufferWriter<Char>)

Decodes the specified ReadOnlySpan<T> to chars using the specified Encoding and writes the result to writer.

GetChars(Encoding, ReadOnlySequence<Byte>, IBufferWriter<Char>)

Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs

Decodes the specified ReadOnlySequence<T> to chars using the specified Encoding and writes the result to writer.

C#
public static long GetChars(this System.Text.Encoding encoding, in System.Buffers.ReadOnlySequence<byte> bytes, System.Buffers.IBufferWriter<char> writer);

Parameters

encoding
Encoding

The encoding that represents how the data in bytes should be decoded.

bytes
ReadOnlySequence<Byte>

The sequence whose bytes should be decoded.

writer
IBufferWriter<Char>

The buffer to which the decoded chars will be written.

Returns

The number of chars written to writer.

Exceptions

bytes contains data that cannot be decoded and encoding is configured to throw when such data is seen.

Applies to

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 5, 6, 7, 8, 9, 10

GetChars(Encoding, ReadOnlySequence<Byte>, Span<Char>)

Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs

Decodes the specified ReadOnlySequence<T> to chars using the specified Encoding and outputs the result to chars.

C#
public static int GetChars(this System.Text.Encoding encoding, in System.Buffers.ReadOnlySequence<byte> bytes, Span<char> chars);

Parameters

encoding
Encoding

The encoding that represents how the data in bytes is encoded.

bytes
ReadOnlySequence<Byte>

The sequence to decode to characters.

chars
Span<Char>

The destination buffer to which the decoded characters will be written.

Returns

The number of chars written to chars.

Exceptions

chars is not large enough to contain the encoded form of bytes.

bytes contains data that cannot be decoded and encoding is configured to throw when such data is seen.

Applies to

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 5, 6, 7, 8, 9, 10

GetChars(Encoding, ReadOnlySpan<Byte>, IBufferWriter<Char>)

Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs

Decodes the specified ReadOnlySpan<T> to chars using the specified Encoding and writes the result to writer.

C#
public static long GetChars(this System.Text.Encoding encoding, ReadOnlySpan<byte> bytes, System.Buffers.IBufferWriter<char> writer);

Parameters

encoding
Encoding

The encoding that represents how the data in bytes should be decoded.

bytes
ReadOnlySpan<Byte>

The span of bytes to decode.

writer
IBufferWriter<Char>

The buffer to which the decoded chars will be written.

Returns

The number of chars written to writer.

Exceptions

bytes contains data that cannot be decoded and encoding is configured to throw when such data is seen.

Applies to

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 5, 6, 7, 8, 9, 10