| 123456789101112131415161718192021 |
- using System.Text.RegularExpressions;
- namespace Day9;
- public partial class Parser
- {
- [GeneratedRegex(@".*")]
- private partial Regex LineMatch();
-
- public IEnumerable<Sequence> Parse(string inputFile)
- {
- using var reader = File.OpenText(inputFile);
-
- while (!reader.EndOfStream)
- {
- var line = reader.ReadLine()!;
- var numbers = line.Split(' ').Select(long.Parse).ToArray();
- yield return new Sequence(numbers);
- }
- }
- }
|