internal BigInteger ReadInteger(Asn1Tag?expectedTag = default) { BigInteger ret = AsnDecoder.ReadInteger(_span, _ruleSet, out int consumed, expectedTag); _span = _span.Slice(consumed); return(ret); }
/// <summary> /// Reads the next value as an Integer with a specified tag. /// </summary> /// <param name="expectedTag"> /// The tag to check for before reading, or <see langword="null"/> for the default tag (Universal 2). /// </param> /// <returns> /// The decoded value. /// </returns> /// <exception cref="AsnContentException"> /// 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. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagClass"/> is /// <see cref="TagClass.Universal"/>, but /// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagValue"/> is not correct for /// the method. /// </exception> public BigInteger ReadInteger(Asn1Tag?expectedTag = null) { BigInteger ret = AsnDecoder.ReadInteger(_data.Span, RuleSet, out int consumed, expectedTag); _data = _data.Slice(consumed); return(ret); }