by Michael S. Kaplan, published on 2006/09/05 07:08 -07:00, original URI: http://blogs.msdn.com/michkap/archive/2006/09/05/741118.aspx
So you take some simple bit of managed code using DateTime.Parse, like the following:
using System;
public class Test {
public static void Main() {
DateTime dt1 = DateTime.Parse("3/15/2007");
Console.WriteLine(dt1);
DateTime dt2 = DateTime.Parse("'3/15/2007'");
Console.WriteLine(dt2);
}
}
Now if you compile this with version 1.1 of the .NET Framework and run it, the output is as follows:
3/15/2007 12:00:00 AM
3/15/2007 12:00:00 AM
And if you do the same with version 2.0 of the .NET Framework and run it, and you escape out of the error dialog that comes up, the following output happens:
3/15/2007 12:00:00 AM
Unhandled Exception: System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.DateTime.Parse(String s)
at Test.Main()
Yikes! I guess you really can tell people not to quote you on this one, huh? :-)
This post broughtto you by ऱ (U+0931, a.k.a. DEVANAGARI LETTER RRA)