Skip to content

Instantly share code, notes, and snippets.

@kalebr
Created October 11, 2013 01:20
Show Gist options
  • Save kalebr/6928204 to your computer and use it in GitHub Desktop.
Save kalebr/6928204 to your computer and use it in GitHub Desktop.
c# count elements below value in list
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
List<double> f = new List<double>();
Random r = new Random();
for (int i = 0; i < 20; i++)
{
f.Add(r.NextDouble() * 100);
}
List<double> c = f.FindAll(n => n <= 50.0);
foreach (double n in c)
{
System.Console.WriteLine(n);
}
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment