Yes, I know it is there as a static, but I want it as a method on IEnumerable<string>.
public static string Join(this IEnumerable<string> source, string joiner)
{
if (source.Count() == 0)
return "";
return source.Aggregate((a,b) => a+ joiner + b);
}
So that when I’ve got some strings I can join them 🙂
var logmessage = people.Select(p=>p.Firstname).Join(“, “);
I really like your “Method I Wish Was There”-series. Did you consider tagging them specifically as such?
I did not, but I will do so in the future.