Where clause with string method and return IEnumerable object

image_pdfimage_print
   
 

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass {
    public static void Main() {


        string[] presidents = {"AA", "A", "AAA", "B", "Ca", "C"};

        IEnumerable<string> items = presidents.Where(p => p.StartsWith("A"));

        foreach (string item in items)
            Console.WriteLine(item);

    }
}

    


This entry was posted in LINQ. Bookmark the permalink.