简体   繁体   中英

IEnumerable<string> to comma separated string

I need to convert the IEnumerable<string> emails to comma separated string . The iEnumerable is actually Hashset<string> with emails, I need to generate string with emails separated by ','

em1@hotmail.com, em2@gmail.com, em3@walla.com

how can I do it without using loop

您可以使用String.Join

string result = String.Join(", ", emails);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM