user1260827
user1260827

Reputation: 1520

find count of elements contains in both collections

For example, we have two collections:

coll1 = {1,2,3,4,5}
coll2 = {3,4,5,6,7,8,9}

How to find count of elements contains in both collections(best performance)?
For example above the result must be equal 3.

Thanks,

Upvotes: 2

Views: 125

Answers (1)

Rob
Rob

Reputation: 1081

coll1.Intersect(coll2 ).Count()

Upvotes: 5

Related Questions