Edit

Share via


Base64Url.TryEncodeToChars Method

Definition

Encodes the span of binary data into unicode ASCII chars represented as Base64Url.

public:
 static bool TryEncodeToChars(ReadOnlySpan<System::Byte> source, Span<char> destination, [Runtime::InteropServices::Out] int % charsWritten);
public static bool TryEncodeToChars (ReadOnlySpan<byte> source, Span<char> destination, out int charsWritten);
static member TryEncodeToChars : ReadOnlySpan<byte> * Span<char> * int -> bool
Public Shared Function TryEncodeToChars (source As ReadOnlySpan(Of Byte), destination As Span(Of Char), ByRef charsWritten As Integer) As Boolean

Parameters

source
ReadOnlySpan<Byte>

The input span which contains binary data that needs to be encoded.

destination
Span<Char>

The output span which contains the result of the operation, i.e. the ASCII chars in Base64Url.

charsWritten
Int32

When this method returns, contains the number of chars written into the output span. This can be used to slice the output for subsequent calls, if necessary. This parameter is treated as uninitialized.

Returns

true if chars encoded successfully; false if destination is too small.

Remarks

This implementation of the base64url encoding omits the optional padding characters.

Applies to