So I have a Blog object which has a list of tag objects (List<Tag>
).
I'm trying to create a method that takes a list of tags and returns a list of blogs that contain all the tags in the passed in list.
I was able to make a method that will return a list of blogs if it matches one tag, but not a list of tags.
to do that I have this
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?
Thank you!
I'm using LINQ to Entities