Base64Url.TryEncodeToUtf8 Method
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.
Encodes the span of binary data into UTF-8 encoded chars represented as Base64Url.
public:
static bool TryEncodeToUtf8(ReadOnlySpan<System::Byte> source, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public static bool TryEncodeToUtf8(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten);
static member TryEncodeToUtf8 : ReadOnlySpan<byte> * Span<byte> * int -> bool
Public Shared Function TryEncodeToUtf8 (source As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean
- source
- ReadOnlySpan<Byte>
The input span which contains binary data that needs to be encoded.
The output span which contains the result of the operation, i.e. the UTF-8 encoded text in Base64Url.
- bytesWritten
- 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.
true
if bytes encoded successfully; false
if destination
is too small.
This implementation of the base64url encoding omits the optional padding characters.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9, 10 |
.NET Standard | 2.0 (package-provided), 2.1 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: