Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Counting pairs within a collection that meet certain condition(s) using LINQ

$
0
0
I have a very big HashSet of integers.
I want to count the number of any two integers within this HashSet  that have a summation valid within a range of integers.

int bottomB = -100;

int topB = 100;

HashSet<int> nums; // Consider this initialized!

int numberOfValids = nums.Count(/*What lambda goes here?*/); // Using LINQ's Count




Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>