Delen via


CborWriter.TryEncode(Span<Byte>, Int32) Method

Definition

Attempts to write the encoded representation of the data to destination.

public:
 bool TryEncode(Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public bool TryEncode (Span<byte> destination, out int bytesWritten);
member this.TryEncode : Span<byte> * int -> bool
Public Function TryEncode (destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean

Parameters

destination
Span<Byte>

The buffer in which to write.

bytesWritten
Int32

When this method returns, contains the number of bytes written to destination.

Returns

true if the encode succeeded, false if destination is too small.

Exceptions

The writer does not contain a complete CBOR value or sequence of root-level values.

Applies to