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

ReadElementContentAsDateTime() public method

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

            object typedValue = InternalReadElementContentAsObject(out xmlType);

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