Methods Calculating a single value
Methods - Calculating a single value
Count() method
The Count() method returns an int
indicating the number of elements in the source sequence that match the predicate
Sum() method
The result of the Sum() call will be the summation of all of these numerical values of elements in the sequence.
Min() and Max() methods
Very simply, the Min() method returns the minimum value from the source sequence and the Max() method returns the maximum value. As with the Sum() method, they can only be called on sequences containing numerical values.
Any() method
Returns true if at least one of the elements in the source sequence matches the provided predicate. Otherwise it returns false.
Any() can also be called without a predicate, in which case it will return true if there is at least one element in the source sequence!
Can you try these for other numerical data types?
Last updated