Where clause with string method and return IEnumerable object
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);
}
}
Related examples in the same category