Why doesn't the conditional operator correctly allow the use of "null" for assignment to nullable ty
- by Daniel Coffman
This will not compile, stating "Type of conditional expression cannot be determined because there is no implicit conversion between 'System.DateTime' and ''"
task.ActualEndDate = TextBoxActualEndDate.Text != "" ? DateTime.Parse(TextBoxActualEndDate.Text) : null;
This works just fine
if (TextBoxActualEndDate.Text != "")
task.ActualEndDate = DateTime.Parse(TextBoxActualEndDate.Text);
else
task.ActualEndDate = null;