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<string> 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

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.