This expression can be used as part of the larger query which returns a collection of all prime numbers that can be represented with the variable of type int.
We have seen that we can test whether a given number is prime by executing the following LINQ expression: bool isPrime =Įnumerable.Range(2, ( int) Math.Sqrt(number) - 1) In previous article titled LINQ Expression to Test If a Number is Prime