LINQ in C# is used to work with data access from sources such as objects, data sets, SQL Server, and XML. LINQ stands for Language Integrated Query.
using System; using System.Linq; namespace CSharpLINQ { class SimpleQuery { static void Main() { int[] numbers = { 1, -2, 3, 0, -4, 5 }; // Create a query that obtains only positive numbers. var posNums = from n in numbers where n > 0 select n; Console.Write("The positive values in numbers: "); // Execute the query and display the results. foreach (var i in posNums) Console.Write(i + " "); } } }