You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.4 KiB
54 lines
1.4 KiB
5 years ago
|
<#@ template language="C#" #>// <auto-generated />
|
||
|
|
||
|
#if FAT
|
||
|
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace LinqInternal.Collections
|
||
|
{
|
||
|
internal static partial class Extensions
|
||
|
{<#
|
||
|
for (var indice = 2; indice < 17; indice++)
|
||
|
{#>
|
||
|
|
||
|
public static IEnumerable<T> Interleave<T>(<# if (indice != 0) { if (indice == 1) #>IEnumerable<T> obj<# else for (var subindice = 1; subindice <= indice; subindice++){ if (subindice != 1) {#>, <#}#>IEnumerable<T> arg<#=subindice#><#}}#>)
|
||
|
{
|
||
|
<#
|
||
|
for (var subindice = 1; subindice <= indice; subindice++)
|
||
|
{#>
|
||
|
if (arg<#=subindice#> == null)
|
||
|
{
|
||
|
throw new ArgumentNullException("arg<#=subindice#>");
|
||
|
}
|
||
|
<#
|
||
|
}#>
|
||
|
var ok = true;
|
||
|
<#
|
||
|
for (var subindice = 1; subindice <= indice; subindice++)
|
||
|
{#>
|
||
|
using (var enumerator<#=subindice#> = arg<#=subindice#>.GetEnumerator())
|
||
|
<#
|
||
|
}#>
|
||
|
{
|
||
|
while (ok)
|
||
|
{
|
||
|
ok = false;
|
||
|
<#
|
||
|
for (var subindice = 1; subindice <= indice; subindice++)
|
||
|
{#>
|
||
|
if (enumerator<#=subindice#>.MoveNext())
|
||
|
{
|
||
|
yield return enumerator<#=subindice#>.Current;
|
||
|
ok = true;
|
||
|
}
|
||
|
<#
|
||
|
}#>
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
<#
|
||
|
}#> }
|
||
|
}
|
||
|
|
||
|
#endif
|