Link to home
Start Free TrialLog in
Avatar of bojeff30
bojeff30

asked on

How to use LINQ in C# to filter a return database list using values from a string array.

I would like to  use LINQ in C# to filter a list of objects using values from a string array. How can i get the list where it only returns the objects that match values in my String Array?


example:
string[] stringArray = { "Bob", "Joe", "Dan", "Rick" };

var newlist = DataObject.where(x => x.names.Contains("any names from my string Array");


note; The Names is a delimited list
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bojeff30
bojeff30

ASKER

Thank you so much! This worked perfectly!