AsnReader.TryReadCharacterStringBytes Method

Definition

Reads the next value as character string with the specified tag, copying the unprocessed bytes into a provided destination buffer.

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

Parameters

destination
Span<Byte>

The buffer in which to write.

expectedTag
Asn1Tag

The tag to check for before reading.

bytesWritten
Int32

On success, receives the number of bytes written to destination.

Returns

true and advances the reader if destination had sufficient length to receive the value, otherwise false and the reader does not advance.

Exceptions

The next value does not have the correct tag.

-or-

The length encoding is not valid under the current encoding rules.

-or-

The contents are not valid under the current encoding rules.

expectedTag.TagClass is Universal, but expectedTag.TagValue is not a character string tag type.

Remarks

This method does not determine if the string used only characters defined by the encoding.

Applies to