I'm trying to map ASYNCHRONOUSLY a collection of items, but I retrieve an unexpected type back. Does anyone know how to solve this and explain to me what the problem exactly is? (I'd like to understand why...)
My Code
List<Project> projects = GetProjects();
return projects.Select(async x => await _mapper.Map<Project, ProjectViewModel>(x)).ToArray();
The interface of my mapper is:
public interface IMapper
{
Task<TDestination> Map<TSource, TDestination>(TSource source);
}
The error
Cannot implicitly convert type 'Task<ProjectViewModel>[]' to 'ProjectViewModel[]'
FYI
I want to have a return type Task<ProjectViewModel[]> for my method