I'd appreciate if someone could advise on the following: I need to select different values (in my case Adapters) based on different conditions, I tried like this:
return this.WrappedEntity.human_screen.SelectMany(e => e).Select(e =>
{
AHuman human = _unitOfWork.HumansRepo.GetById(e.human_uid.ToString());
if (e.vid_screen == "1" && human.Gender== Gender.Female)
{
return new SqlFemaleScreening(e);
}
else if (e.vid_screen == "1" && human.Gender== Gender.Male)
{
return new SqlMaleScreening(e);
}
else
{
return new SqlChildScreening(e);
}
});
But I get the following error:
ERROR: Type arguments for method "
System.Linq.Enumerable.SelectMany <TSource,TResult> (System.Collections.Generic.IEnumerable <TSource>, System.Func <TSource, int, System.Collections.Generic.IEnumerable <TResult>>)
"should be defined for use. Try to clearly define the type arguments.
Thanks a lot in advance!