我有一个datetime对象列表,我想从该列表中获取逗号分隔的字符串,格式为DD/MM/YYYY
,DD/MM/YYYY
,DD/MM/YYYY
List<DateTime> dates ...
c#snipper for ??? ???
答案 0 :(得分:6)
string.Join(",", dates.Select(d => d.ToString("dd/MM/yyyy")).ToArray());
答案 1 :(得分:0)
Linq替代方案:
String.Join(",", from d in dates select String.Format("{0:dd/MM/yyyy}", d))