ID: 5001 - Usos de Linq en C#, Usando un Arreglo.
Posted by mijaelbenmanuel on Mon Mar 08 02:08:48 UTC 2010. Language csharp

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LINQ_prueba
{
class Program
{
static void Main(string[] args)
{


//vamos a sacar los numeros mayores de 5, por medio de un query de linq en un vector...

Console.WriteLine("Vamos a sacar los numeros mayores a 5 ");
Console.Read();

int[] vector;
vector = new int [10];


for (int i = 0; i < 10; i++) // Se puede usar cualquier tipo de arreglo, listas, pilas,Ect.
{

vector[i] = i;
}

var consulta = from x in vector
where x > 5
select x;



foreach (int j in consulta)
{

Console.WriteLine(j);
Console.Read();
Console.Read();

}



}

}
}