CODEKILLER

반응형

Linq - Enumerable.Chunk
Linq - Enumerable.Chunk

public class Example
{
    public static void Main()
    {
        Console.Write("<< Linq - Enumerable.Chunk 출력 예제 >> \n");

        int i = 1;
        foreach (int[] chunk in Enumerable.Range(0, 10).Chunk(3))
        {
            Console.WriteLine($"Chunk {i++}:");
            foreach (int item in chunk)
            {
                Console.WriteLine($"    {item}");
            }

            Console.WriteLine();
        }

        Console.WriteLine(System.Environment.NewLine);
        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
    }
}
반응형

공유하기

facebook twitter kakaoTalk kakaostory naver band