Skip to content

Commit 39c93f5

Browse files
authored
Blazor code example enhancements (#20284)
1 parent a6a654a commit 39c93f5

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

aspnetcore/blazor/components/data-binding.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@ Password:
227227
[Parameter]
228228
public EventCallback<string> PasswordChanged { get; set; }
229229
230-
private Task OnPasswordChanged(ChangeEventArgs e)
230+
private async Task OnPasswordChanged(ChangeEventArgs e)
231231
{
232232
password = e.Value.ToString();
233233
234-
return PasswordChanged.InvokeAsync(password);
234+
await PasswordChanged.InvokeAsync(password);
235235
}
236236
237237
private void ToggleShowPassword()
@@ -287,7 +287,7 @@ Password:
287287
private Task OnPasswordChanged(ChangeEventArgs e)
288288
{
289289
password = e.Value.ToString();
290-
290+
291291
if (password.Contains(' '))
292292
{
293293
validationMessage = "Spaces not allowed!";
@@ -373,9 +373,9 @@ The following components demonstrate the preceding concepts:
373373
set => PropertyChanged.InvokeAsync(value);
374374
}
375375
376-
private Task ChangeValue()
376+
private async Task ChangeValue()
377377
{
378-
return PropertyChanged.InvokeAsync($"Set in Child {DateTime.Now}");
378+
await PropertyChanged.InvokeAsync($"Set in Child {DateTime.Now}");
379379
}
380380
}
381381
```
@@ -400,9 +400,9 @@ The following components demonstrate the preceding concepts:
400400
[Parameter]
401401
public EventCallback<string> PropertyChanged { get; set; }
402402
403-
private Task ChangeValue()
403+
private async Task ChangeValue()
404404
{
405-
return PropertyChanged.InvokeAsync($"Set in Grandchild {DateTime.Now}");
405+
await PropertyChanged.InvokeAsync($"Set in Grandchild {DateTime.Now}");
406406
}
407407
}
408408
```

aspnetcore/blazor/components/event-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ In the following example, `UpdateHeading` is called asynchronously when the butt
5555
@code {
5656
private async Task UpdateHeading(MouseEventArgs e)
5757
{
58-
...
58+
await ...
5959
}
6060
}
6161
```

aspnetcore/blazor/security/webassembly/hosted-with-identity-server.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,20 +402,20 @@ public class ProfileService : IProfileService
402402
{
403403
}
404404

405-
public Task GetProfileDataAsync(ProfileDataRequestContext context)
405+
public async Task GetProfileDataAsync(ProfileDataRequestContext context)
406406
{
407407
var nameClaim = context.Subject.FindAll(JwtClaimTypes.Name);
408408
context.IssuedClaims.AddRange(nameClaim);
409409

410410
var roleClaims = context.Subject.FindAll(JwtClaimTypes.Role);
411411
context.IssuedClaims.AddRange(roleClaims);
412412

413-
return Task.CompletedTask;
413+
await Task.CompletedTask;
414414
}
415415

416-
public Task IsActiveAsync(IsActiveContext context)
416+
public async Task IsActiveAsync(IsActiveContext context)
417417
{
418-
return Task.CompletedTask;
418+
await Task.CompletedTask;
419419
}
420420
}
421421
```

0 commit comments

Comments
 (0)