list comprehension in C#
In C#, LINQ can do list comprehension. Below is the code that builds the list of all Pythagorean triples with elements between 1 and 20. ``` using System.Linq; static class Program { static void Main() { var ts = from a in Enumerable.Range(1, 20) from b in Enumerable.Range(1, 20) from c in Enumerable.Range(1, 20) where a * a + b * b == c * c && a <= b && b <= c select new { a, b, c }; foreach (var t in ts) System.Console.WriteLine("{0}, {1}, {2}", t.a, t.b, t.c); } } ```