I have a List<> which contains another List<>
I need to find if a given value is present in any of the items in the innermost list. If match found, I need that specific item and return.
I am doing this as shown below:
InnerList inner = null; foreach(TopList in topListItems) { inner = asn.Owners.Find(x => x.GuestId == guestId); if(inner != null) break; } //item found if inner is not null //else item absent in the inner list Any other alternate way that may run faster than this? EDIT: Some correction: I just need to see if inner list has an item with a specific value. If yes, then I need to return the top level item that that has the match. I guess the logic is the same.