You can do a Join on all items except the last one and then manually add the last item:
using System;
using System.Linq;
namespace Stackoverflow
{
class Program
{
static void Main(string[] args)
{
DumpResult(new string[] { });
DumpResult(new string[] { "Apple" });
DumpResult(new string[] { "Apple", "Banana" });
DumpResult(new string[] { "Apple", "Banana", "Pear" });
}
private static void DumpResult(string[] someStringArray)
{
string result = string.Join(", ", someStringArray.Take(someStringArray.Length - 1)) + (someStringArray.Length <= 1 ? "" : " and ") + someStringArray.LastOrDefault();
Console.WriteLine(result);
}
}
}
As you can see, there is a check on the amount of items and decides if it's necessary to add the 'and' part.