I rather like
IEnumerable<T>
than
IList<T>
, parameters should be as general as posible. I think it's really getting very fun up here. Here's my choice, just for
string
s.
public static string Join(this IEnumerable<string> parts, string separator)
{
if (! parts.Any())
return string.Empty;
var builder = new StringBuilder();
builder.Append(parts.First()) ;
foreach(var part in parts.Skip(1))
{
builder.Append(separator) ;
builder.Append(part);
}
return builder.ToString();
}