Skip to content

Commit dbe8dbc

Browse files
committed
Fix some warnings
1 parent feaa8df commit dbe8dbc

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

text-counter-razor/Pages/TextCounter.cshtml.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ public class TextCounterModel : PageModel
1111

1212
public void OnPost()
1313
{
14-
TextContent = Request.Form["textContent"]; //get text box input
15-
Characters = TextContent?.Length ?? 0; //update number of characters, words and lines based on entered text
16-
Words =
17-
TextContent
18-
?.Split(new char[] { ' ', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
19-
.Length ?? 0;
20-
Lines = TextContent?.Split('\n', StringSplitOptions.RemoveEmptyEntries).Length ?? 0;
14+
this.TextContent = this.Request.Form["textContent"]; //get text box input
15+
this.Characters = this.TextContent?.Length ?? 0; //update number of characters, words and lines based on entered text
16+
this.Words =
17+
this.TextContent?.Split(
18+
new char[] { ' ', '\r', '\n' },
19+
StringSplitOptions.RemoveEmptyEntries
20+
).Length ?? 0;
21+
this.Lines =
22+
this.TextContent?.Split('\n', StringSplitOptions.RemoveEmptyEntries).Length ?? 0;
2123
}
2224
}

0 commit comments

Comments
 (0)