I’m trying to do some validation testing in VB.NET.
If Entity.WeekEndDate.ToString = String.Empty Then
ErrorList.Add(New cValidationError("id", "Incorrect Week End Date"))
Where WeekEndDate is of type Date. When I originally build the object, how can I insert a value into WeekEndDate that will generate an empty string(ie. “”) when converted from a Date to a String?
It might be better to use
MinValueto represent an invalid date:As a rule, you shouldn’t be converting dates to strings and then comparing them. Compare as the original datatype (in this case, DateTime).