code/Kingdom.OrTools.Sat.CodeGeneration.Core/Extensions/CollectionExtensionMethods.cs
/// <summary>
/// Returns the <paramref name="values"/> delimited by the thing created by
/// <paramref name="delimiterFactory"/>. This behavior is analog to
/// <see cref="string.Join(string, IEnumerable{string})"/> or virtually any of its variants.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="values"></param>
/// <param name="delimiterFactory"></param>
/// <returns></returns>
Returns the  delimited by the thing created by
. This behavior is analog to
or virtually any of its variants.
Returns the delimited by the thing created by . This behavior is analog to or virtually any of its variants .
public static IEnumerable<T> Join<T>(this IEnumerable<T> values, Func<T> delimiterFactory = null)
        {
            delimiterFactory = delimiterFactory ?? (() => default(T));
            if (!values.Any())
            {
                yield break;
            }
            yield return values.First();
            foreach (var value in values.Skip(1))
            {
                yield return delimiterFactory();
                yield return value;
            }
        }
public static IEnumerable < T > Join < T > ( this IEnumerable < T > values , Func < T > delimiterFactory = null ) { delimiterFactory = delimiterFactory ?? ( ( ) => default ( T ) ) ; if ( ! values . Any ( ) ) { yield break ; } yield return values . First ( ) ; foreach ( var value in values . Skip ( 1 ) ) { yield return delimiterFactory ( ) ; yield return value ; } }
Returns the  delimited by the thing created by
.
Returns the delimited by the thing created by .
// ReSharper disable once PossibleMultipleEnumeration // ReSharper disable once PossibleMultipleEnumeration // ReSharper disable once PossibleMultipleEnumeration
None
IEnumerable<T>
this
delimiterFactory
Func<T>
None
values
None
typeparam
None