ソースコード
private static IEnumerable<T> FillToColumnCount<T> ( IEnumerable<T> self, int columnCount, T defaultValue = default ) { var i = 0; foreach ( var x in self ) { yield return x; i = ( i + 1 ) % columnCount; } if ( i == 0 ) yield break; for ( ; i < columnCount; i++ ) { yield return defaultValue; } }