Skip to content

Instantly share code, notes, and snippets.

@Tesla9527
Created September 16, 2015 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tesla9527/c9178165743098666802 to your computer and use it in GitHub Desktop.
Save Tesla9527/c9178165743098666802 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
public class Program
{
static void Main(string[] args)
{
int[] numbers = GenerateLotsOfNumbers(12345678);
var queryResults =
from n in numbers
where n < 1000
select n
;
Console.WriteLine("Numbers less than 1000:");
foreach (var item in queryResults)
{
Console.WriteLine(item);
}
Console.Write("Program finished, press Enter/Return to continue:");
Console.ReadLine();
}
private static int[] GenerateLotsOfNumbers(int count)
{
Random generator = new Random(0);
int[] result = new int[count];
for (int i = 0; i < count; i++)
{
result[i] = generator.Next();
}
return result;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment