Has Any string starting with "J" in CSharp
Description
The following code shows how to has Any string starting with "J".
Example
using System;// ww w . j a v a 2s . c o m
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass {
public static void Main() {
string[] presidents = {"G", "H", "a", "Javascript", "Java", "Jack"};
bool any = presidents.Any(s => s.StartsWith("J"));
Console.WriteLine(any);
}
}
The code above generates the following result.