using System; using System.Collections.Generic; using System.Linq; public class Test { public List MyList { get; set; } public static void Main() { Test t = new Test(); t.MyList = new List(); t.MyList.Add(-1); t.MyList.Add(0); t.MyList.Add(1); t.MyList.Add(2); int siteNumbers = t.MyList.Where(i => i != -1) .Select(x => x) .Distinct() .Count(); Console.WriteLine(siteNumbers); } }