MoreLINQ - LINQ to Objects ν™•μž₯

MoreLINQλŠ” LINQ κΈ°λŠ₯ 쀑 μœ μš©ν•  수 μžˆλŠ” λˆ„λ½λœ κΈ°λŠ₯ κ΅¬ν˜„μž…λ‹ˆλ‹€.

ν•œ 가지 예둜

μ½”λ“œλ₯Ό IEnumerable<T>.Split() ν™•μž₯으둜 μ’€ 더 가독성 있게 ν‘œν˜„ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

var max = File.ReadAllLines("day1_input.txt")
    .Split(x => x is "")
    .Select(x => x.Select(y => int.Parse(y)).Sum())
    .Max();

Console.WriteLine(max);

1개의 μ’‹μ•„μš”