I'm trying to add a search box with Blazor using Blazored Typehead but I'm getting this error:
Severity Code Description Project File Line Suppression State Error CS0411 The type arguments for method 'TypeInference.CreateBlazoredTypeahead_0<TItem, TValue>(RenderTreeBuilder, int, int, Func<string, Task<IEnumerable>>, int, TValue, int, EventCallback, int, Expression<Func>, int, RenderFragment, int, RenderFragment, int, RenderFragment)' cannot be inferred from the usage. Try specifying the type arguments explicitly. SEP3-FrontEnd C:\Users\JimAnt\source\repos\SEP3-FrontEnd\SEP3-FrontEnd\obj\Debug\netcoreapp3.1\Razor\Shared\TopMenu.razor.g.cs 101 Active
Severity Code Description Project File Line Suppression State Error CS0411 The type arguments for method 'TypeInference.CreateBlazoredTypeahead_0<TItem, TValue>(RenderTreeBuilder, int, int, Func<string, Task<IEnumerable>>, int, TValue, int, EventCallback, int, Expression<Func>, int, RenderFragment, int, RenderFragment, int, RenderFragment)' cannot be inferred from the usage. Try specifying the type arguments explicitly. SEP3-FrontEnd C:\Users\JimAnt\source\repos\SEP3-FrontEnd\SEP3-FrontEnd\Shared\TopMenu.razor 1 Active
My code:
@using SEP3_FrontEnd.Models
@using SEP3_FrontEnd.Data
@inject IUserService IuserService;
@inject IChatService IChatService;
@inject User user;
<BlazoredTypeahead SearchMethod="@SearchUsers" @bind-Value="selectedUser">
<SelectedTemplate>
@context.Equals(user.UserName)
</SelectedTemplate>
<ResultTemplate>
@context.Equals(user.UserName)
</ResultTemplate>
<NotFoundTemplate>
Sorry, there weren't any users with that name
</NotFoundTemplate>
</BlazoredTypeahead>
@code {
private User selectedUser;
private async Task<User> SearchUsers(string searchText)
{
return await IuserService.SearchUser(searchText);
}
}
And also part of the other inbuilt class that this error shows up in:
public partial class TopMenu : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__Blazor.SEP3_FrontEnd.Shared.TopMenu.TypeInference.CreateBlazoredTypeahead_0(__builder, 0, 1,
I'm fairly new to C# so any help would be greatly appreciated