public override double ReadContentAsDouble()
{
if (!CanReadContentAs(this.NodeType))
{
throw CreateReadContentAsException(nameof(ReadContentAsDouble));
}
object typedValue = InternalReadContentAsObject();
XmlSchemaType xmlType = NodeType == XmlNodeType.Attribute ? AttributeXmlType : ElementXmlType;
try
{
if (xmlType != null)
{
return xmlType.ValueConverter.ToDouble(typedValue);
}
else
{
return XmlUntypedConverter.Untyped.ToDouble(typedValue);
}
}
catch (InvalidCastException e)
{
throw new XmlException(SR.Xml_ReadContentAsFormatException, "Double", e, this as IXmlLineInfo);
}
catch (FormatException e)
{
throw new XmlException(SR.Xml_ReadContentAsFormatException, "Double", e, this as IXmlLineInfo);
}
catch (OverflowException e)
{
throw new XmlException(SR.Xml_ReadContentAsFormatException, "Double", e, this as IXmlLineInfo);
}
}