1
using System
.Collections
.Generic
;
4 namespace IEnumerableExtras
7 /// Provide <see cref="IEnumerable{T}"/> with Join extension method.
9 public static class EnumerableJoin
12 /// Join all members of this <see cref="IEnumerable{T}"/> to a single string using <paramref name="glue"/>
15 /// <typeparam name="T"></typeparam>
16 /// <param name="enumerable"></param>
17 /// <param name="glue"></param>
18 /// <returns></returns>
19 public static string Join
<T
>(this IEnumerable
<T
> enumerable
, string glue
)
21 return enumerable
.Reduce( new StringBuilder(), ( sb
, item
) => sb
.Length
== 0 ? sb
.Append( item
) : sb
.Append( glue
).Append( item
) ).ToString();