TIP! LINQ local variable
Monday, January 7th, 2008I found a new simple feature in LINQ, if you need localy defined variable in your query then just use let keyword.
Sample - function returning only even double numbers:
int[] list = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
IEnumerable<int> x = from l in list
let dbl = l * l
where dbl % 2 == 0
select dbl;
// result => 4, 16, 36, 64, 100


Naučte se WPF - český tutoriál