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();
}
I Received a Bachelor's Degree in Computer Science at the Mathematics and Computer Science Faculty, University of Havana, Cuba.
I mainly work in web applications using C# and some Javascript. Some very few times do some Java.