@for (int i = 0; i < values.Count; i++)
{
<input type="checkbox" @bind="values[i]" />
}
@code {
private List<bool> values = new List<bool>() { true, true, false };
}
Why did the following exception occur when I clicked the "checkbox" generated by the above code?
Unhandled exception rendering component: Index was out of range. Must be non-negative and less than the size of the collection.
What is the right way? Thanks a lot.