using System;
using System.Collections.Generic;
using System.Linq;
namespace NilPointer
{
class Program
{
static void Main(string[] args)
{
var numbers = new List<int> {
50, 2, -7, 11,-9, 26, 6, 42
};
var count1 = numbers.Count;
Console.WriteLine("Count 1: " + count1);
var count2 = numbers.Count(number => number > 0);
Console.WriteLine("Count 2: " + count2);
Console.ReadLine();
}
}
}
Output
Count 1: 8
Count 2: 6