C# LINQ Basics
LINQ queries collections with Where, Select, OrderBy, Sum, Count and more. It reads like SQL and uses lambda expressions. Add using System.Linq.
Example
using System.Linq;
int[] n = { 1, 2, 3, 4, 5, 6 };
Console.WriteLine(string.Join(",", n.Where(x => x % 2 == 0)));
Console.WriteLine(string.Join(",", n.Select(x => x * x)));
Console.WriteLine(n.Sum() + " " + n.Max());Exercise
Keep matching items.
n.(x => x > 2)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.