Skip to content

Commit 5f6d8e5

Browse files
committed
Use indexes and ranges
1 parent 5c071cd commit 5f6d8e5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/EditorFeatures/Core.Cocoa/Snippets/SnippetFunctions/AbstractSnippetFunctionGenerateSwitchCases.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public AbstractSnippetFunctionGenerateSwitchCases(AbstractSnippetExpansionClient
2424
: base(snippetExpansionClient, subjectBuffer)
2525
{
2626
this.CaseGenerationLocationField = caseGenerationLocationField;
27-
this.SwitchExpressionField = (switchExpressionField.Length >= 2 && switchExpressionField[0] == '$' && switchExpressionField[switchExpressionField.Length - 1] == '$')
28-
? switchExpressionField.Substring(1, switchExpressionField.Length - 2) : switchExpressionField;
27+
this.SwitchExpressionField = (switchExpressionField.Length >= 2 && switchExpressionField[0] == '$' && switchExpressionField[^1] == '$')
28+
? switchExpressionField[1..^1] : switchExpressionField;
2929
}
3030

3131
protected abstract bool TryGetEnumTypeSymbol(CancellationToken cancellationToken, [NotNullWhen(returnValue: true)] out ITypeSymbol? typeSymbol);

0 commit comments

Comments
 (0)