private static TimestampParseResult TryParseExactCore(string input, string[] formats, IFormatProvider formatProvider, DateTimeStyles styles, out Timestamp result) { ValidateParseInput(input); if (formats == null) { throw new ArgumentNullException("formats"); } if (formats.Length == 0) { throw new ArgumentException("The 'formats' must not be empty.", "formats"); } ValidateParseStyles(styles); if (input.Length == 0) { result = default(Timestamp); return(TimestampParseResult.EmptyInput); } foreach (var format in formats) { if (TimestampStringConverter.TryParseExact(input, format, formatProvider, styles, out result) == TimestampParseResult.Success) { return(TimestampParseResult.Success); } } result = default(Timestamp); return(TimestampParseResult.NoMatchedFormats); }
private static TimestampParseResult TryParseExactCore(string input, string format, IFormatProvider formatProvider, DateTimeStyles styles, out Timestamp result) { ValidateParseInput(input); if (input.Length == 0) { result = default(Timestamp); return(TimestampParseResult.EmptyInput); } if (format == null) { throw new ArgumentNullException("format"); } if (format.Length == 0) { throw new ArgumentException("The 'format' must not be empty.", "format"); } ValidateParseStyles(styles); var error = TimestampStringConverter.TryParseExact(input, format, formatProvider, styles, out result); if (error == TimestampParseResult.UnsupportedFormat) { // UnsupportedFormat should throw Exception instead of returning false. HandleParseResult(error, "Cannot parse specified input with specified format."); } return(error); }