Compound from: identifies ordered pairs of integers : Compound from « LINQ « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass {
    public static void Main() {

        int[] numbersA = { 0, 2, 4, 5, 6, 8, 9 };
        int[] numbersB = { 1, 3, 5, 7, 8 };

        var pairs =
            from a in numbersA
            from b in numbersB
            where a < b
            select new { a, b };

        Console.WriteLine("Pairs where a < b:");
        foreach (var pair in pairs) {
            Console.WriteLine("{0} is less than {1}", pair.a, pair.b);
        }
    }
}








22.26.Compound from
22.26.1.Compound from: identifies ordered pairs of integers
22.26.2.Compound from: prints all orders whose total is less that 500
22.26.3.Using a compound from clause to select all orders where the order was made in 1998 or later.
22.26.4.from Assignment: select all orders where the order total is greater than 2000.00
22.26.5.Multiple from: filtering on value list can be done before selecting their orders
22.26.6.Printing the customer number and orderID for every order in the list