I am inferring you want to make a table with Blazor. I will assume that you want to make a table row for each item. The amount of those items is variable. What you need is templated components.
MyTable.razor
<table>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">UserName</th>
</tr>
</thead>
<tbody>
@foreach (var lineItem in LineItems)
{
<tr>@LineItemTemplate(lineItem)</tr>
}
</tbody>
</table>
MyTable.razor.cs
[Parameter, EditorRequired]
public RenderFragment<TItem> LineItemTemplate { get; set; } = default!;
[Parameter, EditorRequired]
public IReadOnlyList<TItem> LineItems { get; set; } = default!;
Then you can build what you wanted as follows:
<MyTable LineItems="_users" Context="user">
<LineItemTemplate>
<MyLine UserWithUserName="user">
</LineItemTemplate>
</MyTable>
Of course, for completeness sake, MyLine.razor would look something like this:
<tr>
<th scope="row">@(User.Order)</th>
<td>@(User.FirstName)</td>
<td>@(User.LastName)</td>
<td>@(User.UserName)</td>
</tr>
MyLine.razor.cs
[Parameter, EditorRequired] public UserWithUserName User { get; set; }
Bear in my that this is partially assumption that this is what you wanted. But it seemed that when I was looking for an answer, I found yours. And this is what I needed.
Cheers!