Skip to content

Commit 954ae2b

Browse files
committed
Simplified switch patterns.
1 parent 68917d4 commit 954ae2b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

FileRenamer.Core/Indices/DescriptionHelper.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ public static string GetDescription(IIndex startIndex, IIndex endIndex)
99
{
1010
return (startIndex, endIndex) switch
1111
{
12-
(BeginningIndex, FileExtensionIndex) => "file name",
13-
(FixedIndex fix, FileExtensionIndex) when fix.Index == 0 => "file name",
12+
(BeginningIndex, FileExtensionIndex) or
13+
(FixedIndex { Index: 0 }, FileExtensionIndex) => "file name",
1414

1515
(FileExtensionIndex, EndIndex) => "file extension",
1616

17-
(BeginningIndex, EndIndex) => "all characters",
18-
(FixedIndex fix, EndIndex) when fix.Index == 0 => "all characters",
17+
(BeginningIndex, EndIndex) or
18+
(FixedIndex { Index: 0 }, EndIndex) => "all characters",
1919

20-
(FixedIndex fix, EndIndex) when fix.Index == -1 => "the last character",
20+
(FixedIndex { Index: -1 }, EndIndex) => "the last character",
2121
(FixedIndex fix, EndIndex) when fix.Index < 0 => "the last " + "character".ToQuantity(-fix.Index),
2222

2323
_ => $"characters from {startIndex.Description.ToString(includePreposition: false)} to {endIndex.Description.ToString(includePreposition: false)}",

0 commit comments

Comments
 (0)