0

How can I search from user input the data from one array and get the corresponding data from other arrays? For example, the user wants the get the information by searching their name which has an id number in another array.

1 Answer 1

1

I use Linq for this situation.

 public class Person
 {
      public string Name { get; set; }
      public int Id { get; set; }
 }


 IEnumerable<string> names = data.Where(x => input.Any(y => y.Id == x.Id)).Select(x => x.Name);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.