LINQ search inside a collection based on a given list of items : Lets say I am given a list<string> as input:

    IList<string> availableFruits = {orange, banana}

I have a fruit entity that looks like this:

    public Fruit 
    { 
        public int ID { get; set; }
    
        public string name { get; set; }
    }

we define some fruits:

    var f1 = new Fruit { Id = 1, name = "apple" };
    var f2 = new Fruit { Id = 2, name = "banana" };
    var f3 = new Fruit { Id = 3, name = "orange" };
    var f4 = new Fruit { Id = 4, name = "pineapple" };

Finally, we have a menu where these fruits go:

    public class Menu
    {
        public int ID { get; set; }

        public ICollection<Fruit> fruits;
    }

     var menus = new List<Menu>
            {
                new Menu {ID = 0, fruits = new List<Fruit> { f1, f2 } },

                new Menu {ID = 1, fruits = new List<Fruit> { f1, f3, f4 } },

                new Menu {ID = 2, fruits = new List<Fruit> { f1, f4 } },

                new Menu {ID = 3, fruits = new List<Fruit> { f2 } },
            };

I need a LINQ query that searches in the menus and returns all menus that contains 'ANY' of the fruits passed in the avaiableFruits list. Thus in this case it will return menus with ID's 0, 1 and 3.


Thanks in advance for you help.

Fike