开发者

join List of dates

开发者 https://www.devze.com 2023-03-07 11:33 出处:网络
I have a list of d开发者_开发技巧atetime object, I want to get a comma separated string from that list with format like DD/MM/YYYY, DD/MM/YYYY, DD/MM/YYYY

I have a list of d开发者_开发技巧atetime object, I want to get a comma separated string from that list with format like DD/MM/YYYY, DD/MM/YYYY, DD/MM/YYYY

List<DateTime> dates ...

c# snipper for that???


string.Join(",", dates.Select(d => d.ToString("dd/MM/yyyy")).ToArray());


Linq alternative:

String.Join(",", from d in dates select String.Format("{0:dd/MM/yyyy}", d))
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号