Skip to content

Commit 9664cff

Browse files
foreach variable can be captured. (#18955)
1 parent 709bac6 commit 9664cff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

aspnetcore/blazor/components/event-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ It's often convenient to close over additional values, such as when iterating ov
128128
```
129129

130130
> [!NOTE]
131-
> Do **not** use a loop variable directly in a lambda expression, such as `i` in the preceding `for` loop example or a reference variable in a `foreach` loop. Otherwise, the same variable is used by all lambda expressions, which results in use of the same value in all lambdas. Always capture the variable's value in a local variable and then use it. In the preceding example, the loop variable `i` is assigned to `buttonNumber`.
131+
> Do **not** use a loop variable directly in a lambda expression, such as `i` in the preceding `for` loop example. Otherwise, the same variable is used by all lambda expressions, which results in use of the same value in all lambdas. Always capture the variable's value in a local variable and then use it. In the preceding example, the loop variable `i` is assigned to `buttonNumber`.
132132
133133
## EventCallback
134134

0 commit comments

Comments
 (0)