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);
}
}