If you want to join items in an array with some common string in between them, you can use the string.Join method (note I'm using Environment.NewLine instead of \r\n because it's more platform-friendly):
public void AddToTextArea(string[] newStrings)
{
tbArea += string.Join(Environment.NewLine, newStrings) + Environment.NewLine;
}
The string.Join method takes in a string to conacatenate the items with and then returns a string containing all the items joined with the specified string. A more common example is:
int[] items = {1,2,3,4,5};
Console.WriteLine(string.Join(", ", items));
// Output: "1, 2, 3, 4, 5"
Note that there is no leading or trailing connecting string (", ") added to the list, so in your case we add a newline character to the end.
An alternative would be to create an overload that takes in a single string, and then call that method for each item in the string array:
public void AddToTextArea(string[] newStrings)
{
foreach (string newString in newStrings)
{
AddToTextArea(newString);
}
}
public void AddToTextArea(string newString)
{
tbArea = tbArea + newString + Environment.NewLine;
}
.ToString()behavior in .NET is to return the full name of the type. So technically nothing is wrong - you just need to tell .NET how to combine the elements of the array into a singlestring.