System.Xml.XmlReader.ReadContentAsDateTime C# (CSharp) Method

ReadContentAsDateTime() public method

public ReadContentAsDateTime ( ) : System.DateTime
return System.DateTime
        public virtual DateTime ReadContentAsDateTime()
        {
            if (!CanReadContentAs())
            {
                throw CreateReadContentAsException(nameof(ReadContentAsDateTime));
            }
            try
            {
                return XmlConvert.ToDateTime(InternalReadContentAsString(), XmlDateTimeSerializationMode.RoundtripKind);
            }
            catch (FormatException e)
            {
                throw new XmlException(SR.Xml_ReadContentAsFormatException, "DateTime", e, this as IXmlLineInfo);
            }
        }

Usage Example

 public override DateTime ReadContentAsDateTime()
 {
     CheckAsync();
     return(_coreReader.ReadContentAsDateTime());
 }
All Usage Examples Of System.Xml.XmlReader::ReadContentAsDateTime