Project Description
LINQ's query operators came with .Net 3.5. The query operators are inside System.Linq.Enumerable and cannot be used in .Net 2.0.
The existing knowledge of using .Net 3.5/4 Linq to Object query operators can be fully applied.
Sample Program: (in VS 2005)
using System;
using Tanker;
namespace Demo
{
class Program
{
static void Main(string[] args)
{
int[] ints = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
Sequence<int> nums = Sequence.Create(ints);
Sequence<int> query = nums
.Where(delegate(int i) { return i % 2 == 0; })
.Select<int>(delegate(int i) { return i + i; });
query.ForEach(Console.WriteLine);
Person p1 = new Person("Peijuin");
Person p2 = new Person("Pranalan");
Person p3 = new Person("Elvin");
Person[] personArray = new Person[] {p1, p1, p2, p3};
Sequence<Person> people = Sequence.Create(personArray);
Sequence<Person> selectedPeople = people
.Where(delegate(Person p) { return p.Name.StartsWith("P"); });
selectedPeople.ForEach(delegate(Person p) { Console.WriteLine(p.Name); });
}
}
public class Person
{
private string name;
public Person(string name)
{
this.name = name;
}
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
}
}
Currently only a few operators are implemented and unit-tested. The rest are still being implemented. See the below picture to know more.