Click here to Skip to main content
15,896,557 members
Articles / General Programming / String

Converting Array or List of data to String => made easy! (C#, MVC3, LINQ)

Rate me:
Please Sign up or sign in to vote.
4.75/5 (4 votes)
18 Jan 2012CPOL 15.7K  
I would just use:string.Join(",", cities.Select(c=>c.Name))Since Version 4 of the Framework there is an overloaded versions of string.Join for IEnumerable too. It uses a StringBuilder internally and doesn't insert a seperator after the last element as well.I could't find the Join method...

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions