From a4db131c6971e8c9f13722209e7afa2c37864c69 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:09:07 -0400 Subject: [PATCH] Language updates to loop varaible content (#33649) --- aspnetcore/blazor/components/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aspnetcore/blazor/components/index.md b/aspnetcore/blazor/components/index.md index cf49923f5dbd..52be13b3f501 100644 --- a/aspnetcore/blazor/components/index.md +++ b/aspnetcore/blazor/components/index.md @@ -1268,7 +1268,7 @@ Consider the following `RenderFragmentChild2` component that has both a componen When rendering the `RenderFragmentChild2` component in a parent component, use a local index variable (`ct` in the following example) instead of the loop variable (`c`) when assigning the component parameter value and providing the child component's content: ```razor -

Three children with an index variable

+

Three children with a for loop and an index variable

@for (int c = 1; c < 4; c++) { @@ -1283,7 +1283,7 @@ When rendering the `RenderFragmentChild2` component in a parent component, use a Alternatively, use a [`foreach`](/dotnet/csharp/language-reference/keywords/foreach-in) loop with instead of a [`for`](/dotnet/csharp/language-reference/keywords/for) loop: ```razor -

Second example of three children with an index variable

+

Alternative approach without an index variable

@foreach (var c in Enumerable.Range(1, 3)) {