Is there any faster way to catch an exception?
try {date = new date time (model_data. Year, model_date death, (7 * multiplier) + (7 - do) + 2); } Hold (exception) {// This is an invalid date}
String date string = string.format ("{0} / {1} / {2}", model_date death, (7 * multiplier) + (7 - do) + 2), model_date. Date time date time; If the date (DateTime.TryParse (DateString, out dateTime)) {// valid}
As a comment given by GenericTypeTea, this code will not run as fast as you can, however, Believe that you get benefit in readability.
Comments
Post a Comment