-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components
Description
Creating a component when I want to have it as generic as possible but if I try to use EventCallback with a type of T then I get a Cannot convert from 'method group' to 'Event Callback' error
`
TestComponent
@typeparam T
@foreach (var x in TableData)
{
<a @OnClick="@(()=>DeleteCallback.InvokeAsync(x))">
}
@code {
[Parameter]
public List<T> TableData { get; set; }
[Parameter]
public EventCallback<T> DeleteCallback { get; set; }
}`
`
@code
{
public class Item
{
public Guid Id { get; set; }
}
public List<Item> example = new List<Item>
{
new Item
{
Id = Guid.NewGuid()
}
};
public async Task OnDelete(Item item)
{
}
}`
I've created a basic repo here - https://github.com/scott-david-walker/EventCallbackError
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components