I try to create an AsyncCommand with a parameter.
I used this method but it's not working.
public static AsyncCommand<T> Create(Func<System.Threading.Tasks.Task<T>> func)
{
return new AsyncCommand<T>(new Command<T>(async (x) => await func(x)));
}
And when I call it with my viewmodel:
public ICommand OnRemoveTagCommand = AsyncCommand<ResultElementRatingDto>.Create(RemoveTag);
private async Task<ResultElementRatingDto> RemoveTag(ResultElementRatingDto ratingDto)
{
return null;
}
The error is:
cannot convert from 'method group' to 'Func'
What's wrong in my code?
RemoveTagtakes a DTO, where does that come from?OnRemoveTagCommand= new Command(async(obj) => {});