Less magic, more readable, would be:
DateTime dt1; DateTime dt2; if (DateTime.TryParseExact(str1, "dd-MMM-yyyy", null, DateTimeStyles.None, out dt1) && DateTime.TryParseExact(str2, "dd-MMM-yyyy", null, DateTimeStyles.None, out dt2)) { // do something with those datetimes }
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)