Partilhar via


AsnDecoder.TryReadUInt32 Method

Definition

Important

This API is not CLS-compliant.

Attempts to read an Integer value from source with a specified tag under the specified encoding rules as an unsigned 32-bit value.

[System.CLSCompliant(false)]
public static bool TryReadUInt32 (ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, out uint value, out int bytesConsumed, System.Formats.Asn1.Asn1Tag? expectedTag = default);
[<System.CLSCompliant(false)>]
static member TryReadUInt32 : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * uint32 * int * Nullable<System.Formats.Asn1.Asn1Tag> -> bool
Public Shared Function TryReadUInt32 (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, ByRef value As UInteger, ByRef bytesConsumed 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.

value
UInt32

On success, receives the interpreted numeric value. This parameter is treated as uninitialized.

bytesConsumed
Int32

When this method returns, the total number of bytes for the encoded value. This parameter is treated as uninitialized.

expectedTag
Nullable<Asn1Tag>

The tag to check for before reading, or null for the default tag (Universal 2).

Returns

true if the Integer represents value is between UInt32.MinValue and UInt32.MaxValue, inclusive; otherwise, false.

Attributes

Exceptions

ruleSet is not defined.

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 correct for the method.

Applies to