Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor 8 Delegate Type Could Not Be Inferred

$
0
0

I am migrating my Blazor Server from .NET 7 to 8. Apparently it causes error on calling the function this way:

<input type="checkbox" class="form-check" checked="@isChecked"        @onchange="@((e) => AddRemoveSelection((int)i.Id!, Convert.ToBoolean(e.Value)))" />

The compiler says

The delegate type could not be inferred

and highlighted => arrow function with red underline.

Here is the method:

private void AddRemoveSelection(int id, bool isSelected){    if (isSelected)    {        // Adding ids to selection        if (!selectedIds.Any(s => s == id))        {            selectedIds.Add(id);        }    }    else    {        var s = selectedIds.Find(s => s == id);        selectedIds.Remove(s);    }}

Is there any change in Blazor on .NET 8 that disables this syntax?


Viewing all articles
Browse latest Browse all 4839

Trending Articles