Fundamentals
Arrays
function Sum-OfPositive($NumberArray) { [Func[int,bool]]$Delegate = {param($v); return $v -ge 0} [Linq.Enumerable]::Sum([Linq.Enumerable]::Where([int[]]$NumberArray,$Delegate)) }
- function Sum-OfPositive($NumberArray)
- {
($NumberArray | ?{$_ -gt 0} | Measure -sum).Sum- [Func[int,bool]]$Delegate = {param($v); return $v -ge 0}
- [Linq.Enumerable]::Sum([Linq.Enumerable]::Where([int[]]$NumberArray,$Delegate))
- }