linq - How can I change my method to achive the following? -


I have a way to find a collection of employees by name. I pass the array of last names which I want to meet, and the law gives employees with these names is simple. Public IQueryable & lt; Employee & gt; GetEmployees (IEnumerable & lt; string & gt; last name) {var query = employee. Where (E => Last name is included (E. Last Name)); Return query; }

Now I need to change the law so that I can cross the array of partial last names, and get all the employees whose last name matches the partial last name Eat. / P>

  Public IQueryable & lt; Employee & gt;   

So if I have employees with these names: Sigourney Weaver, Amanda Beaver, John Smith, Jane Matheson (Ianumerable & lt; String & gt; partial ListNames)

And I pass partial "unknown", "mathematics"], it will return a query to me which can be sent to the questioning signer, Weyener, Amanada Beaver and Jane Matheson

How can I do this?

Thank you

I think you are looking for it

  Public IQuer Yable & lt; Employee & gt; GetEmployees (IEnumerable & lt; String & gt; Partial ListNames) {var query = employee. Where (E = & gt; Partial ListNames.Any (x => E.Lostname.Source (x)); Return query; }    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -