diff options
author | Ben Harris <ben@tilde.team> | 2021-11-12 17:34:25 -0500 |
---|---|---|
committer | Ben Harris <ben@tilde.team> | 2021-11-12 17:34:25 -0500 |
commit | dd34b55e0c0615fb5640bb8e36b698fb8efa0a66 (patch) | |
tree | 13d608a3b1b95ac9d6de73f4b18b251603f1acf1 | |
parent | 26b2bc73c7cdc44fd8557cf6e3c24feb806f8059 (diff) |
switch to expression body for simple methods
-rw-r--r-- | aoc2021/Day01.cs | 10 | ||||
-rw-r--r-- | aoc2021/DayXX.cs.txt | 10 | ||||
-rw-r--r-- | 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 /// </summary> /// <param name="stopwatch"></param> /// <returns></returns> - 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; /// <summary> /// Does a <see cref="Range"/> include a given int? @@ -23,8 +21,6 @@ public static class Extensions /// <param name="range"></param> /// <param name="i"></param> /// <returns></returns> - 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; } |