I'm thinking if these line of codes can be simplified using lambda expressions like using valueList.ForEach? I'm new on lambda expressions.
foreach (var item in OrderList)
{
item.ReserveDate = DateTime.ParseExact(item.ReserveDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToShortDateString();
item.ExpireDate = DateTime.ParseExact(item.ExpireDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToShortDateString();
}
DRYapproach:Func<string,sting> parse = d => DateTime.ParseExact(d, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToShortDateString();(created before the loop) and use the lambda to assign both valuesitem.ReserveDate = parse(item.ReserveDate);