LINQ Example - Basic idea on how to query using LINQ

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

namespace Demo
    class Program
        static void Main(string[] args)
            string[] namesList = { "AB", "AC", "BB", "BC", "CA", "CB", "DD", "DA", "ABC", "GD", "ED", "AA", "BD" };

            var queryResult =
                from n in namesList
                where n.StartsWith("A")
                select n;

            Console.WriteLine("Names beginning with A:");

            foreach (var item in queryResult)

            Console.Write("press Enter to continue:");


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now