<#@ template language="C#" #>// #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 Interleave(<# if (indice != 0) { if (indice == 1) #>IEnumerable obj<# else for (var subindice = 1; subindice <= indice; subindice++){ if (subindice != 1) {#>, <#}#>IEnumerable 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