Use string method in where clause

image_pdfimage_print
   
 


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);
    }
}

    


This entry was posted in LINQ. Bookmark the permalink.