System.Xml.XmlDictionaryReader.ReadElementContentAsBase64 C# (CSharp) Méthode

ReadElementContentAsBase64() public méthode

public ReadElementContentAsBase64 ( ) : byte[]
Résultat byte[]
        public virtual byte[] ReadElementContentAsBase64()
        {
            bool isEmptyElement = IsStartElement() && IsEmptyElement;
            byte[] buffer;

            if (isEmptyElement)
            {
                Read();
                buffer = Array.Empty<byte>();
            }
            else
            {
                ReadStartElement();
                buffer = ReadContentAsBase64();
                ReadEndElement();
            }

            return buffer;
        }

Usage Example

Exemple #1
0
        /// <summary>
        /// Reads the XML stream or document with an <see cref="T:System.Xml.XmlDictionaryReader" /> and returns the deserialized object; it also enables you to specify whether the serializer can read the data before attempting to read it.
        /// </summary>
        /// <param name="reader">An <see cref="T:System.Xml.XmlDictionaryReader" /> used to read the XML document.</param>
        /// <param name="verifyObjectName">true to check whether the enclosing XML element name and namespace correspond to the root name and root namespace; otherwise, false to skip the verification.</param>
        /// <returns>
        /// The deserialized object.
        /// </returns>
        public override object ReadObject(XmlDictionaryReader reader, bool verifyObjectName)
        {
            Argument.IsNotNull("reader", reader);

            var memoryStream = new MemoryStream(reader.ReadElementContentAsBase64());
            return BinarySerializerHelper.DiscoverAndDeSerialize(memoryStream, _type);
        }
All Usage Examples Of System.Xml.XmlDictionaryReader::ReadElementContentAsBase64