From dd34b55e0c0615fb5640bb8e36b698fb8efa0a66 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Fri, 12 Nov 2021 17:34:25 -0500 Subject: [PATCH] switch to expression body for simple methods --- aoc2021/Day01.cs | 10 ++-------- aoc2021/DayXX.cs.txt | 10 ++-------- aoc2021/Extensions.cs | 12 ++++-------- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/aoc2021/Day01.cs b/aoc2021/Day01.cs index 2dc1d33..22fdced 100644 --- a/aoc2021/Day01.cs +++ b/aoc2021/Day01.cs @@ -9,13 +9,7 @@ public sealed class Day01 : Day { } - public override string Part1() - { - return ""; - } + public override string Part1() => ""; - public override string Part2() - { - return ""; - } + public override string Part2() => ""; } diff --git a/aoc2021/DayXX.cs.txt b/aoc2021/DayXX.cs.txt index 20a578a..d9fc52a 100644 --- a/aoc2021/DayXX.cs.txt +++ b/aoc2021/DayXX.cs.txt @@ -9,13 +9,7 @@ public sealed class DayXX : Day { } - public override string Part1() - { - return ""; - } + public override string Part1() => ""; - public override string Part2() - { - return ""; - } + public override string Part2() => ""; } diff --git a/aoc2021/Extensions.cs b/aoc2021/Extensions.cs index 268d6a9..44202c4 100644 --- a/aoc2021/Extensions.cs +++ b/aoc2021/Extensions.cs @@ -12,10 +12,8 @@ public static class Extensions /// /// /// - public static double ScaleMilliseconds(this Stopwatch stopwatch) - { - return 1_000 * stopwatch.ElapsedTicks / (double)Stopwatch.Frequency; - } + public static double ScaleMilliseconds(this Stopwatch stopwatch) => + 1_000 * stopwatch.ElapsedTicks / (double)Stopwatch.Frequency; /// /// Does a include a given int? @@ -23,8 +21,6 @@ public static class Extensions /// /// /// - public static bool Contains(this Range range, int i) - { - return i >= range.Start.Value && i <= range.End.Value; - } + public static bool Contains(this Range range, int i) => + i >= range.Start.Value && i <= range.End.Value; }