So, I have a Blog object that has a list of tag objects ( List<Tag> ).
I am trying to create a method that accepts a list of tags and returns a list of blogs that contain all the tags in the submitted list.
I managed to create a method that will return a list of blogs if it matches a single tag but not a list of tags.
to do it i have it
entities.Blogs.Where(b => b.Tags.Any(t => t.Name == tagName))
But I can't figure out how to do something like this
entities.Blogs.Where(b => b.Tags.Any(t => t.Name == tags[0] AND t.Name == tags[1] AND t.Name == tags[2] etc.......))
Is there any way to do this?
Thanks!
I am using LINQ to Entities
c # linq
hanesjw
source share