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. 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> 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 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; }
Public IQueryable & lt; Employee & gt;
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
Post a Comment