コード例 #1
0
        /// <summary>
        ///   Write the provided string using the specified encoding type using the specified
        ///   tag corresponding to the encoding type.
        /// </summary>
        /// <param name="tag">The tag to write.</param>
        /// <param name="encodingType">
        ///   The <see cref="UniversalTagNumber"/> corresponding to the encoding to use.
        /// </param>
        /// <param name="str">The string to write.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        ///   <paramref name="encodingType"/> is not a restricted character string encoding type --OR--
        ///   <paramref name="encodingType"/> is a restricted character string encoding type that is not
        ///   currently supported by this method
        /// </exception>
        /// <exception cref="ArgumentException">
        ///   <paramref name="tag"/>.<see cref="Asn1Tag.TagClass"/> is
        ///   <see cref="TagClass.Universal"/>, but
        ///   <paramref name="tag"/>.<see cref="Asn1Tag.TagValue"/> is not correct for
        ///   the method
        /// </exception>
        /// <exception cref="ObjectDisposedException">The writer has been Disposed.</exception>
        public void WriteCharacterString(Asn1Tag tag, UniversalTagNumber encodingType, ReadOnlySpan <char> str)
        {
            CheckUniversalTag(tag, encodingType);

            Encoding encoding = AsnCharacterStringEncodings.GetEncoding(encodingType);

            WriteCharacterStringCore(tag, encoding, str);
        }
コード例 #2
0
        /// <summary>
        ///   Write the provided string using the specified encoding type using the UNIVERSAL
        ///   tag corresponding to the encoding type.
        /// </summary>
        /// <param name="encodingType">
        ///   The <see cref="UniversalTagNumber"/> corresponding to the encoding to use.
        /// </param>
        /// <param name="str">The string to write.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        ///   <paramref name="encodingType"/> is not a restricted character string encoding type --OR--
        ///   <paramref name="encodingType"/> is a restricted character string encoding type that is not
        ///   currently supported by this method
        /// </exception>
        /// <exception cref="ObjectDisposedException">The writer has been Disposed.</exception>
        /// <seealso cref="WriteCharacterString(Asn1Tag,UniversalTagNumber,ReadOnlySpan{char})"/>
        public void WriteCharacterString(UniversalTagNumber encodingType, ReadOnlySpan <char> str)
        {
            Encoding encoding = AsnCharacterStringEncodings.GetEncoding(encodingType);

            WriteCharacterStringCore(new Asn1Tag(encodingType), encoding, str);
        }