Check if a string array has elements whose length is longer than 5 in CSharp
Description
The following code shows how to check if a string array has elements whose length is longer than 5.
Example
/* w ww .j a v a 2 s. c o m*/
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass {
public static void Main() {
string[] presidents = {"G123456", "H", "a", "H", "over", "Jack"};
bool all = presidents.All(s => s.Length > 5);
Console.WriteLine(all);
}
}
The code above generates the following result.