I think this should give you what you are looking for. This will allow you to select the Title property from each object into an array of strings, and then join all the elements of this array into a string separated by "-".
List<Title> lst = new List<Title>
{
new Title{Id = 1, Title = "title1"},
new Title{Id = 2, Title = "title2"}
}
String.Join("-", lst.Select(x => x.Title).ToArray());
If you are using .NET 4.0 or later, there is now an overload to String.Join, which allows you to omit .ToArray():
String.Join("-", lst.Select(x => x.Title));
goric source
share