Redigera

Dela via


Convert.TryToBase64Chars Method

Definition

Tries to convert the 8-bit unsigned integers inside the specified read-only span into their equivalent string representation that is encoded with base-64 digits. You can optionally specify whether to insert line breaks in the return value.

public static bool TryToBase64Chars (ReadOnlySpan<byte> bytes, Span<char> chars, out int charsWritten, Base64FormattingOptions options = System.Base64FormattingOptions.None);
static member TryToBase64Chars : ReadOnlySpan<byte> * Span<char> * int * Base64FormattingOptions -> bool
Public Shared Function TryToBase64Chars (bytes As ReadOnlySpan(Of Byte), chars As Span(Of Char), ByRef charsWritten As Integer, Optional options As Base64FormattingOptions = System.Base64FormattingOptions.None) As Boolean

Parameters

bytes
ReadOnlySpan<Byte>

A read-only span of 8-bit unsigned integers.

chars
Span<Char>

The span in which to write the string representation in base 64 of the elements in bytes. If the length of bytes is 0, or when this method returns false, nothing is written into this parameter.

charsWritten
Int32

When this method returns, contains the total number of characters written into chars.

options
Base64FormattingOptions

One of the enumeration values that specify whether to insert line breaks in the return value. The default value is None.

Returns

true if the conversion is successful; otherwise, false.

Exceptions

options is not a valid Base64FormattingOptions value.

Applies to