Csharp/C Sharp/LINQ/Sub Query
Версия от 15:31, 26 мая 2010; (обсуждение)
A subquery is a query contained within another query"s lambda expression.
using System;
using System.Collections.Generic;
using System.Linq;
public class MainClass {
public static void Main() {
string[] musos = { "D G", "R W", "R W" };
IEnumerable<string> query = musos.OrderBy(m => m.Split().Last());
}
}
uses a subquery to sort String
using System;
using System.Collections.Generic;
using System.Linq;
public class MainClass {
public static void Main() {
string[] musos = { "D C", "R B", "W A" };
IEnumerable<string> query = musos.OrderBy(m => m.Split().Last());
}
}