i have some code that looks like this and creates a list from an existing collection
var items = items.ConvertAll(r => new
{
description = FormatDescription(r),
start = r.Milestone.HasValue ? r.Milestone.Value.ToString("yyyy-MM-ddTHH:mm:ssZ") : DateTime.Today.ToString("yyyy-MM-ddTHH:mm:ssZ"),
classname = "significance" + r.SignificanceLevel,
As you can see, right now if i dont have a start date (r.Milestone) then i put in today's date. What i really want to do if say:
- if i have a r.Milestone.Hasvalue show that date, if i dont have a value DONT HAVE THE START DATE field in the anonymous type at all.
Is it possible to have this conditional logic where you can remove the field all together inside this type of code?