I have a string array variable.
private string[] _documents;
Values to it are assigned like this.
string[] _documents = { "doc1", "doc2", "doc3" };
And there’s a method which adds a string to that array and returns it.
public string GetMail()
{
return originalMessage + " " + _documents[0];
}
Defining _documents[0] returns only the first element of the array.
How can I return all the elements in the array? (Kinda like what implode function does in PHP)
I am not familiar with PHP, but you can concatenate all elements of a string array with
string.Join:The first parameter is the separator; you can pass an empty string if you do not need separators.