refactor: Simplify input class
This commit is contained in:
parent
8fc5668e60
commit
5f74f2bffa
1 changed files with 2 additions and 9 deletions
|
|
@ -3,13 +3,6 @@ namespace AdventOfCode2025.Inputs;
|
|||
public sealed record Input(int Day, int PartNumber = 1)
|
||||
{
|
||||
private const string BasePath = "../../../Inputs/";
|
||||
public string ToPath() => BasePath + $"Day{Day}_{PartNumber}.txt";
|
||||
}
|
||||
|
||||
public static class InputExtensions
|
||||
{
|
||||
extension(Input input)
|
||||
{
|
||||
public IEnumerable<string> Lines => File.ReadAllLines(input.ToPath());
|
||||
}
|
||||
private string ToPath() => BasePath + $"Day{Day}_{PartNumber}.txt";
|
||||
public IEnumerable<string> Lines => field ??= File.ReadAllLines(ToPath());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue