Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Text.​EncodingExtensions

Assembly: System.Memory

Inheritance: object → EncodingExtensions

Provides extension methods for the encoding types, such as <see cref="T:System.Text.Encoding" /> , <see cref="T:System.Text.Encoder" /> , and <see cref="T:System.Text.Decoder" /> .

Methods

public static void
Convert​(Decoder decoder, Buffers.​ReadOnlySequence`1& bytes, Buffers.​IBufferWriter<​char> writer, bool flush, Int64& charsUsed, Boolean& completed)
public static void
Convert​(Decoder decoder, ReadOnlySpan<​byte> bytes, Buffers.​IBufferWriter<​char> writer, bool flush, Int64& charsUsed, Boolean& completed)
public static void
Convert​(Encoder encoder, Buffers.​ReadOnlySequence`1& chars, Buffers.​IBufferWriter<​byte> writer, bool flush, Int64& bytesUsed, Boolean& completed)
public static void
Convert​(Encoder encoder, ReadOnlySpan<​char> chars, Buffers.​IBufferWriter<​byte> writer, bool flush, Int64& bytesUsed, Boolean& completed)
public static byte[]
GetBytes​(Encoding encoding, Buffers.​ReadOnlySequence`1& chars)
public static long
GetBytes​(Encoding encoding, Buffers.​ReadOnlySequence`1& chars, Buffers.​IBufferWriter<​byte> writer)
public static int
GetBytes​(Encoding encoding, Buffers.​ReadOnlySequence`1& chars, Span<​byte> bytes)
public static long
GetBytes​(Encoding encoding, ReadOnlySpan<​char> chars, Buffers.​IBufferWriter<​byte> writer)
Encodes the specified <see cref="T:System.ReadOnlySpan`1" /> to <see langword="byte" /> s using the specified <see cref="T:System.Text.Encoding" /> and writes the result to <paramref name="writer" /> .
Returns The number of bytes written to <paramref name="writer" /> .
encoding The encoding that represents how the data in <paramref name="chars" /> should be encoded.
chars The sequence to encode to bytes.
writer The buffer to which the encoded bytes will be written.
public static long
GetChars​(Encoding encoding, Buffers.​ReadOnlySequence`1& bytes, Buffers.​IBufferWriter<​char> writer)
public static int
GetChars​(Encoding encoding, Buffers.​ReadOnlySequence`1& bytes, Span<​char> chars)
public static long
GetChars​(Encoding encoding, ReadOnlySpan<​byte> bytes, Buffers.​IBufferWriter<​char> writer)
Decodes the specified <see cref="T:System.ReadOnlySpan`1" /> to <see langword="char" /> s using the specified <see cref="T:System.Text.Encoding" /> and writes the result to <paramref name="writer" /> .
Returns The number of chars written to <paramref name="writer" /> .
encoding The encoding that represents how the data in <paramref name="bytes" /> should be decoded.
bytes The span of bytes to decode.
writer The buffer to which the decoded chars will be written.
public static string
GetString​(Encoding encoding, Buffers.​ReadOnlySequence`1& bytes)
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object