I pass a String Array to a function with the code below. The lines in the array are the first part of the email addresses. I need to add domain.com at the end of each line and a "," between each address. I have a working code below, but just wondering if there is a way (better / cleaner / more efficient) to do this?
String toAddress = "";
for (int x = 0; x < addresses.Length; x++)
{
if (x == (addresses.Length-1))
{
toAddress += addresses[x] + "@domain.com";
}
else
{
toAddress += addresses[x] + "@domain.com,";
}
}
source
share