I am trying to pull data from the table which has a DateTime data type with NULL values. I am trying to get the required data by using the below method. However, it's throwing an error : ArgumentNullException: Value cannot be null. (Parameter 's')
TermDate = s.TermDate.HasValue ? s.TermDate : DateTime.Parse(s.TermDate.ToString().Replace(null, "-"))
Property: public DateTime? TermDate { get; set; }
Please advise.