I have a class
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
List<Person> PersonList = new List<Perso>();
PersonList.Add(new Person() { FirstName = "aa", LastName = "AA" } );
PersonList.Add(new Person() { FirstName = "bb", LastName = "BB" } );
I’d like get a string with a comma separator for the LastName, using Linq, the result look like:
AA,BB
Thanks,
If you’re using .NET 4:
If you’re using .NET 3.5:
(Basically .NET 4 had some extra overloads added to
string.Join.)