internal static bool TryParseExactMultiple(String s, String[] formats,
DateTimeFormatInfo dtfi, DateTimeStyles style, ref DateTimeResult result) {
if (s == null) {
result.SetFailure(ParseFailureKind.ArgumentNull, "ArgumentNull_String", null, "s");
return false;
}
if (formats == null) {
result.SetFailure(ParseFailureKind.ArgumentNull, "ArgumentNull_String", null, "formats");
return false;
}
if (s.Length == 0) {
result.SetFailure(ParseFailureKind.Format, "Format_BadDateTime", null);
return false;
}
if (formats.Length == 0) {
result.SetFailure(ParseFailureKind.Format, "Format_BadFormatSpecifier", null);
return false;
}
BCLDebug.Assert(dtfi != null, "dtfi == null");
//
// Do a loop through the provided formats and see if we can parse succesfully in
// one of the formats.
//
for (int i = 0; i < formats.Length; i++) {
if (formats[i] == null || formats[i].Length == 0) {
result.SetFailure(ParseFailureKind.Format, "Format_BadFormatSpecifier", null);
return false;
}
if (TryParseExact(s, formats[i], dtfi, style, out result.parsedDate)) {
return (true);
}
}
result.SetFailure(ParseFailureKind.Format, "Format_BadDateTime", null);
return (false);
}