【发布时间】:2012-11-20 18:53:04
【问题描述】:
我有一个名为 reportLogs 的 DateTime 集合。我需要从这个Collection<DateTime> 创建一个Collection<T> 的ShortDateString。最有效的方法是什么?
Collection<DateTime> reportLogs = reportBL.GetReportLogs(1, null, null);
Collection<string> logDates = new Collection<string>();
foreach (DateTime log in reportLogs)
{
string sentDate = log.ToShortDateString();
logDates.Add(sentDate);
}
编辑:
问题是关于Collection of string;不是关于List of string。我们如何处理字符串的集合?
参考:
【问题讨论】: