System.Xml.XsdValidatingReader.ReadElementContentAsBoolean C# (CSharp) Method

ReadElementContentAsBoolean() public method

public ReadElementContentAsBoolean ( ) : bool
return bool
        public override bool ReadElementContentAsBoolean()
        {
            if (this.NodeType != XmlNodeType.Element)
            {
                throw CreateReadElementContentAsException(nameof(ReadElementContentAsBoolean));
            }
            XmlSchemaType xmlType;

            object typedValue = InternalReadElementContentAsObject(out xmlType);

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