cool breeze
cool breeze

Reputation: 4811

How to create an iterator based on another collection

I have a collection of Users List where User looks like: User -id -uniqueKey (String)

I have another collection of List where ExternalUser has a uniqueKey also.

I want to loop through the List, but actually return a External User.

How can I create an iterator that does this?

Upvotes: 0

Views: 71

Answers (1)

Nathan C
Nathan C

Reputation: 205

Without having your sample code, it is hard to fully answer. However, this is a code sample that I believe would provide you with what you are looking for:

var externalUsers = users.Select(user => externalUserIds.Contains(user.UniqueKey));

That will provide you with a iterator of user object instances which have a UniqueKey of an external user.

Upvotes: 1

Related Questions