Mega Code Archive

 
Categories / C# / LINQ
 

Use string method in where clause

using System; using System.Linq; public class MainClass {     public static void Main() {         string[] greetings = { "hello world", "hello LINQ", "hello" };         var items =          from s in greetings          where s.EndsWith("LINQ")          select s;         foreach (var item in items)             Console.WriteLine(item);     } }