I have and array object that is a
List<ContactModel> contactList;
public class ContactModel
{
public string CustomKey { get; set; }
public string[] ContactGroups { get; set; }
}
So objects would be
{"1", {"Group A"} }
{"2", {"Group A", "Group B", "Group C"} }
{"3", {"Group C", "Group D"} }
{"4", {"Group A", "Group B", "Group C", "Group D"} }
The ContactGroups contains a list of groups {"Group A", "Group B", "Group C","Group D"} that a given contact exists in. I can get results for one group by using the following.
var selectedContracts =
from contact in contacts
where contact.ContactGroups.Contains("Group A")
select new { contact.CustomKey, contact.ContactGroups };
Is there a way to get a list back with all objects containing one of a list of objects.
var selectedContracts =
from contact in contacts
where contact.ContactGroups.Contains("Group A", "Group B")
select new { contact.CustomKey, contact.ContactGroups };
I need to get back object 1,2,4.
Target method:
Examples of usage:
Help methods: