CoseMessage.Encode Method

Definition

Overloads

Encode()

Encodes this message as CBOR.

Encode(Span<Byte>)

Encodes this message as CBOR.

Encode()

Source:
CoseMessage.cs
Source:
CoseMessage.cs
Source:
CoseMessage.cs

Encodes this message as CBOR.

C#
public byte[] Encode ();

Returns

Byte[]

The message encoded as CBOR.

Exceptions

The ProtectedHeaders and UnprotectedHeaders collections have one or more labels in common.

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

Encode(Span<Byte>)

Source:
CoseMessage.cs
Source:
CoseMessage.cs
Source:
CoseMessage.cs

Encodes this message as CBOR.

C#
public int Encode (Span<byte> destination);

Parameters

destination
Span<Byte>

The buffer in which to write the encoded value.

Returns

The number of bytes written to destination.

Exceptions

destination is too small to hold the value.

The ProtectedHeaders and UnprotectedHeaders collections have one or more labels in common.

Remarks

Use GetEncodedLength() to determine how many bytes result in encoding this message.

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)