Join a list of object's properties into a String

Viewed 21430

I'm learning lambda right now, and I wonder how can I write this code by a single line with lambda.

I have a Person class which includes an ID and name fields

Currently, I have a List<Person> which stores these Person objects. What I want to accomplish is to get a string consisting of person's id just like.

"id1,id2,id3".

How can I accomplish this with lambda?

4 Answers
Related