CSharp examples for LINQ:where
filter based using > operator
using System;/*from www . ja v a2s . c om*/ using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Xml.Linq; class MainClass { static void Main(string[] args) { // create the data IList<Item> datasource = createData(); // filter based using > operator IEnumerable<Item> result2 = from e in datasource where e.Level > 5 select e; Console.WriteLine("\nFilter for life > 5 days"); foreach (Item fruit in result2) { Console.WriteLine("Item {0}", fruit.Name); } } static IList<Item> createData() { return new List<Item>() { new Item("Oracle", "green", 7), new Item("MySQL", "MySQL", 10), new Item("C", "green", 4), new Item("CSS", "brown", 12), new Item("C", "green", 4), new Item("HTML", "brown", 12), new Item("XML", "red", 2), new Item("Javascript", "green", 4), new Item("fig", "brown", 12), new Item("SQL", "red", 2), new Item("C", "green", 4), new Item("SVG", "brown", 12), new Item("XML", "red", 2), new Item("XML", "red", 2), new Item("file", "yellow", 10), new Item("PLSQL", "red", 7) }; } } class Item { public Item(string namearg, string colorarg, int lifearg) { Name = namearg; Color = colorarg; Level = lifearg; } public string Name { get; set;} public string Color { get; set;} public int Level { get; set;} }