Where with OrderBy

image_pdfimage_print
   
 

using System;
using System.Collections.Generic;
using System.Linq;
public class MainClass {
    public static void Main() {
        string[] names = { "J", "P", "G", "Pa" };

        IEnumerable<string> query = names.Where(n => n.Contains("a"))
                                         .OrderBy(n => n.Length)
                                         .Select(n => n.ToUpper());

    }
}

    


This entry was posted in LINQ. Bookmark the permalink.