Reputation: 531
I've got list of Contact
objects that among others, has a mailaddress
string property. I would like to create a ";" delimited string from all these addresses. Is it possible to do this with a built-in function like the Join(delimiter,array)
or the Join (of ...)
, without iterating trough the list manually?
Upvotes: 1
Views: 3288
Reputation: 13571
Sorta.
Dim str = string.Join(";"c, YourList.Select(function(c) c.mailaddress))
You don't have to use a foreach loop, but the list does have to be iterated. LINQ can do that for you.
Upvotes: 9
Reputation: 442
Short answer, NO.
You will have to iterate through all the Contacts
, adding the mailaddress
properties to a New List(Of String)
.
To get your delimited string, YourList.ToArray().Join(",")
Hope that helps.
Upvotes: -1