Here I am having below Linq query which has employee duration column. How can I remove "-" when StartDate
or EndDate
is null. I want "-" only when both are not null.
var query = from r in db.Employee
select new
{
Name = r.Name,
EmployeeDuration = r.StartDate +" - "+ r.EndDate
}