EncodingExtensions.GetBytes 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
| Name | Description |
|---|---|
|
GetBytes(Encoding, ReadOnlySequence |
Encodes the specified ReadOnlySequence |
|
GetBytes(Encoding, ReadOnlySequence |
Decodes the specified ReadOnlySequence |
|
GetBytes(Encoding, ReadOnlySequence |
Encodes the specified ReadOnlySequence |
|
GetBytes(Encoding, ReadOnlySpan |
Encodes the specified ReadOnlySpan |
GetBytes(Encoding, ReadOnlySequence)
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
Encodes the specified ReadOnlySequence
public:
[System::Runtime::CompilerServices::Extension]
static cli::array ^ GetBytes(System::Text::Encoding ^ encoding, System::Buffers::ReadOnlySequence % chars);
public static byte[] GetBytes(this System.Text.Encoding encoding, in System.Buffers.ReadOnlySequence chars);
static member GetBytes : System.Text.Encoding * ReadOnlySequence -> byte[]
Public Function GetBytes (encoding As Encoding, ByRef chars As ReadOnlySequence(Of Char)) As Byte()
Parameters
- encoding
- Encoding
The encoding that represents how the data in chars should be encoded.
- chars
- ReadOnlySequence<Char>
The sequence to encode to bytes.
Returns
A Byte array that represents the encoded contents of chars.
Exceptions
chars contains data that cannot be encoded and encoding is configured to throw when such data is seen.
Applies to
GetBytes(Encoding, ReadOnlySequence, IBufferWriter)
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
Decodes the specified ReadOnlySequencebytes using the specified Encoding and writes the result to writer.
public:
[System::Runtime::CompilerServices::Extension]
static long GetBytes(System::Text::Encoding ^ encoding, System::Buffers::ReadOnlySequence % chars, System::Buffers::IBufferWriter ^ writer);
public static long GetBytes(this System.Text.Encoding encoding, in System.Buffers.ReadOnlySequence chars, System.Buffers.IBufferWriter writer);
static member GetBytes : System.Text.Encoding * ReadOnlySequence * System.Buffers.IBufferWriter -> int64
Public Function GetBytes (encoding As Encoding, ByRef chars As ReadOnlySequence(Of Char), writer As IBufferWriter(Of Byte)) As Long
Parameters
- encoding
- Encoding
The encoding that represents how the data in chars should be encoded.
- chars
- ReadOnlySequence<Char>
The ReadOnlySequence
- writer
- IBufferWriter<Byte>
The buffer to which the encoded bytes will be written.
Returns
The number of bytes written to writer.
Exceptions
chars contains data that cannot be encoded and encoding is configured to throw when such data is seen.
Applies to
GetBytes(Encoding, ReadOnlySequence, Span)
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
Encodes the specified ReadOnlySequencebytes using the specified Encoding and outputs the result to bytes.
public:
[System::Runtime::CompilerServices::Extension]
static int GetBytes(System::Text::Encoding ^ encoding, System::Buffers::ReadOnlySequence % chars, Span bytes);
public static int GetBytes(this System.Text.Encoding encoding, in System.Buffers.ReadOnlySequence chars, Span bytes);
static member GetBytes : System.Text.Encoding * ReadOnlySequence * Span -> int
Public Function GetBytes (encoding As Encoding, ByRef chars As ReadOnlySequence(Of Char), bytes As Span(Of Byte)) As Integer
Parameters
- encoding
- Encoding
The encoding that represents how the data in chars should be encoded.
- chars
- ReadOnlySequence<Char>
The sequence to encode to bytes.
Returns
The number of bytes written to bytes.
Exceptions
bytes is not large enough to contain the encoded form of chars.
chars contains data that cannot be encoded and encoding is configured to throw when such data is seen.
Applies to
GetBytes(Encoding, ReadOnlySpan, IBufferWriter)
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
- Source:
- EncodingExtensions.cs
Encodes the specified ReadOnlySpanbytes using the specified Encoding and writes the result to writer.
public:
[System::Runtime::CompilerServices::Extension]
static long GetBytes(System::Text::Encoding ^ encoding, ReadOnlySpan chars, System::Buffers::IBufferWriter ^ writer);
public static long GetBytes(this System.Text.Encoding encoding, ReadOnlySpan chars, System.Buffers.IBufferWriter writer);
static member GetBytes : System.Text.Encoding * ReadOnlySpan * System.Buffers.IBufferWriter -> int64
Public Function GetBytes (encoding As Encoding, chars As ReadOnlySpan(Of Char), writer As IBufferWriter(Of Byte)) As Long
Parameters
- encoding
- Encoding
The encoding that represents how the data in chars should be encoded.
- chars
- ReadOnlySpan<Char>
The sequence to encode to bytes.
- writer
- IBufferWriter<Byte>
The buffer to which the encoded bytes will be written.
Returns
The number of bytes written to writer.
Exceptions
chars contains data that cannot be encoded and encoding is configured to throw when such data is seen.