AsnDecoder.TryReadCharacterString Method
Definition
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.
Reads a character string value from source
with a specified tag under
the specified encoding rules, copying the decoded string into a provided destination buffer.
public static bool TryReadCharacterString (ReadOnlySpan<byte> source, Span<char> destination, System.Formats.Asn1.AsnEncodingRules ruleSet, System.Formats.Asn1.UniversalTagNumber encodingType, out int bytesConsumed, out int charsWritten, System.Formats.Asn1.Asn1Tag? expectedTag = default);
static member TryReadCharacterString : ReadOnlySpan<byte> * Span<char> * System.Formats.Asn1.AsnEncodingRules * System.Formats.Asn1.UniversalTagNumber * int * int * Nullable<System.Formats.Asn1.Asn1Tag> -> bool
Public Shared Function TryReadCharacterString (source As ReadOnlySpan(Of Byte), destination As Span(Of Char), ruleSet As AsnEncodingRules, encodingType As UniversalTagNumber, ByRef bytesConsumed As Integer, ByRef charsWritten As Integer, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As Boolean
Parameters
- source
- ReadOnlySpan<Byte>
The buffer containing encoded data.
- ruleSet
- AsnEncodingRules
The encoding constraints to use when interpreting the data.
- encodingType
- UniversalTagNumber
One of the enumeration values which represents the value type to process.
- bytesConsumed
- Int32
When this method returns, the total number of bytes for the encoded value. This parameter is treated as uninitialized.
- charsWritten
- Int32
When this method returns, the number of chars written to destination
.
This parameter is treated as uninitialized.
The tag to check for before reading, or null
for the universal tag that is
appropriate to the requested encoding type.
Returns
true
and advances the reader if destination
had sufficient
length to receive the value, otherwise
false
and the reader does not advance.
Exceptions
ruleSet
is not defined.
-or-
<code data-dev-comment-type="paramref">encodingType</code> is not a known character string type.
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.
-or-
The string did not successfully decode.