I am trying to return a List<Image> but am having trouble with the following method:
public List<Image> GetImageByCollection(int id)
{
List<Image> images = collectionDb.Images.SelectMany(i => i.CollectionId == id);
return images;
}
I am new to Linq so its probably something basic but hopefully you can see what I am trying to do. If I am not clear please say and I will try to clarify.
You actually what a Where and ToList
Select and SelectMany will return an
IEnumerable<T>of the predicate. For example,Now SelectMany will “flatten” a list of objects.
…
allStringscontains “1”, “2”, “3”, “4”