Mega Code Archive
0387 The let Keyword
The let keyword introduces a new variable alongside the range variable.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main()
{
string[] names = { "Java", "C#", "Javascript" };
IEnumerable query =
from n in names
let vowelless = n.Replace("a", "").Replace("e", "").Replace("i", "").Replace("o", "").Replace("u", "")
where vowelless.Length > 2
orderby vowelless
select n;
foreach(string s in query){
Console.WriteLine(s);
}
}
}
The output:
Javascript