System.Xml.XsdValidatingReader.ReadElementContentAsInt C# (CSharp) Méthode

ReadElementContentAsInt() public méthode

public ReadElementContentAsInt ( ) : int
Résultat int
        public override int ReadElementContentAsInt()
        {
            if (this.NodeType != XmlNodeType.Element)
            {
                throw CreateReadElementContentAsException(nameof(ReadElementContentAsInt));
            }
            XmlSchemaType xmlType;

            object typedValue = InternalReadElementContentAsObject(out xmlType);

            try
            {
                if (xmlType != null)
                {
                    return xmlType.ValueConverter.ToInt32(typedValue);
                }
                else
                {
                    return XmlUntypedConverter.Untyped.ToInt32(typedValue);
                }
            }
            catch (FormatException e)
            {
                throw new XmlException(SR.Xml_ReadContentAsFormatException, "Int", e, this as IXmlLineInfo);
            }
            catch (InvalidCastException e)
            {
                throw new XmlException(SR.Xml_ReadContentAsFormatException, "Int", e, this as IXmlLineInfo);
            }
            catch (OverflowException e)
            {
                throw new XmlException(SR.Xml_ReadContentAsFormatException, "Int", e, this as IXmlLineInfo);
            }
        }
XsdValidatingReader