Return query from nested Enumerable methods in CSharp
Description
The following code shows how to return query from nested Enumerable methods.
Example
/*from w w w .j a va 2 s . c o m*/
using System;
using System.Collections.Generic;
using System.Linq;
public class MainClass {
public static void Main() {
string[] names = { "Tom", "Dick", "Harry", "Mary", "Jay" };
IEnumerable<string> query =
Enumerable.Select(
Enumerable.OrderBy(
Enumerable.Where(
names, n => n.Contains("a")
), n => n.Length
), n => n.ToUpper()
);
foreach(var v in query){
Console.WriteLine(v);
}
}
}
The code above generates the following result.