AsnDecoder.ReadBoolean(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>) 方法

定义

在指定编码规则下,从带有指定标记的 source 中读取布尔值。Reads a Boolean value from source with a specified tag under the specified encoding rules.

public static bool ReadBoolean (ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, out int bytesConsumed, System.Formats.Asn1.Asn1Tag? expectedTag = default);
static member ReadBoolean : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * int * Nullable<System.Formats.Asn1.Asn1Tag> -> bool
Public Shared Function ReadBoolean (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, ByRef bytesConsumed As Integer, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As Boolean

参数

source
ReadOnlySpan<Byte>

包含编码数据的缓冲区。The buffer containing encoded data.

ruleSet
AsnEncodingRules

解释数据时要使用的编码约束。The encoding constraints to use when interpreting the data.

bytesConsumed
Int32

此方法返回时,为编码值的字节总数。When this method returns, the total number of bytes for the encoded value. 该参数未经初始化即被处理。This parameter is treated as uninitialized.

expectedTag
Nullable<Asn1Tag>

读取前要检查的标记,或使用 null 作为默认标记(通用 1)。The tag to check for before reading, or null for the default tag (Universal 1).

返回

Boolean

已解码的值。The decoded value.

例外

未定义 ruleSetruleSet 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.TagClassexpectedTag.TagClass Universal,但 expectedTag.TagValueis Universal, but expectedTag.TagValue 对于此方法而言是不正确的。is not correct for the method.

适用于