Skip to content

Commit ecbb7ac

Browse files
committed
Prefer range operators over Substring()
This syntax is shorter and more intuitive. It also alleviates IDE0057. This can only be done in the .NET 3.x projects; unfortunately, it isn't supported by .NET Standard 2.0, so we can't apply this elsewhere until we do away with .NET Framework 4.8 support in OnTopic 5.0.
1 parent f54409d commit ecbb7ac

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

OnTopic.AspNetCore.Mvc/TopicViewResultExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public ViewEngineResult FindView(ActionContext actionContext, TopicViewResult vi
122122
// Get content-type after the slash and replace '+' characters in the content-type to '-' for view file encoding
123123
// purposes
124124
var acceptHeader = splitHeaders[i]
125-
.Substring(splitHeaders[i].IndexOf("/", StringComparison.InvariantCulture) + 1)
125+
[(splitHeaders[i].IndexOf("/", StringComparison.InvariantCulture) + 1)..]
126126
.Replace("+", "-", StringComparison.InvariantCulture);
127127
// Validate against available views; if content-type represents a valid view, stop validation
128128
if (acceptHeader is not null) {

0 commit comments

Comments
 (0)