Update to .NET 6 and C# 6 for `implicit using directives`

This commit is contained in:
Stefan Forstenlechner 2021-12-01 22:24:44 +01:00
parent 98fe28cb59
commit 96fe2d121d
4 changed files with 7 additions and 12 deletions

View File

@ -2,7 +2,10 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10</LangVersion>
<ImplicitUsings>true</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -1,10 +1,6 @@
#define Day1
#if Day1
using System;
using System.IO;
using System.Linq;
var scans = File.ReadAllText("day1/input").Split("\n", StringSplitOptions.RemoveEmptyEntries).Select(l => int.Parse(l)).ToList();
var scans = File.ReadAllLines("day1/input").Select(int.Parse).ToList();
Console.WriteLine(Enumerable.Range(1, scans.Count - 1).Count(i => scans[i - 1] < scans[i]));
Console.WriteLine(Enumerable.Range(3, scans.Count - 3).Count(i => scans[i - 3] < scans[i]));
#endif

View File

@ -1,8 +1,4 @@
// #define Day2
#if Day2
using System;
using System.IO;
using System.Linq;
var toBeDefined = File.ReadAllText("day2/input").Split("\n", StringSplitOptions.RemoveEmptyEntries);
var toBeDefined = File.ReadAllLines("day2/input");
#endif

View File

@ -10,7 +10,7 @@ Before moving to the next file, comment out the first line again, as only one fi
### Requirements
C# 9.0 and .NET 5
C# 10.0 and .NET 6
### Execute