[Mono-dev] DateTime.TryParseExact
Sanghyeon Seo
sanxiyn at gmail.com
Wed May 24 05:23:09 EDT 2006
Attached patch implements .NET 2.0 method DateTime.TryParseExact.
Needed to compile IronPython 1.0 Beta 7.
Seo Sanghyeon
-------------- next part --------------
Index: class/corlib/System/DateTime.cs
===================================================================
--- class/corlib/System/DateTime.cs (revision 61039)
+++ class/corlib/System/DateTime.cs (working copy)
@@ -1417,7 +1417,33 @@
throw new FormatException ();
return result;
}
-
+
+#if NET_2_0
+ public static bool TryParseExact (string s, string format,
+ IFormatProvider fp,
+ DateTimeStyles style,
+ out DateTime result)
+ {
+ string[] formats;
+
+ formats = new string [1];
+ formats[0] = format;
+
+ return TryParseExact (s, formats, fp, style, out result);
+ }
+
+ public static bool TryParseExact (string s, string[] formats,
+ IFormatProvider fp,
+ DateTimeStyles style,
+ out DateTime result)
+ {
+ DateTimeFormatInfo dfi = DateTimeFormatInfo.GetInstance (fp);
+
+ bool longYear = false;
+ return ParseExact (s, formats, dfi, style, out result, true, ref longYear);
+ }
+#endif
+
private static bool ParseExact (string s, string [] formats,
DateTimeFormatInfo dfi, DateTimeStyles style, out DateTime ret,
bool exact, ref bool longYear)
More information about the Mono-devel-list
mailing list