Get Last string starting with H in CSharp
Description
The following code shows how to get Last string starting with H.
Example
//from w w w. j a v a 2s . c o m
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass {
public static void Main() {
string[] presidents = {"Java", "HTML", "Apple", "HTML5", "CSS", "Javascript"};
string name = presidents.Last(p => p.StartsWith("H"));
Console.WriteLine(name);
}
}
The code above generates the following result.