public WmDate SelectWmDate(string xPath) { if (string.IsNullOrEmpty(xPath)) { throw new ArgumentNullException(nameof(xPath)); } string text = SelectNotEmptyString(xPath); WmDate wmDate; if (!WmDate.TryParseServerString(text, out wmDate)) { throw new FormatException(string.Format(CultureInfo.InvariantCulture, "The value of the element '{0}' is not in a correct format.", xPath)); } return(wmDate); }
public WmDate?SelectWmDateIfExists(string xPath) { if (string.IsNullOrEmpty(xPath)) { throw new ArgumentNullException(nameof(xPath)); } string text = TrySelectNotEmptyString(xPath); if (null == text) { return(null); } if (!WmDate.TryParseServerString(text, out var wmDate)) { throw new FormatException(string.Format(CultureInfo.InvariantCulture, "The value '{0}' of the element '{1}' is not in a correct format.", text, xPath)); } return(wmDate); }