Filter string by its length
using System;
using System.Collections.Generic;
using System.Linq;
class LinqDemo {
static void Main() {
string[] names = { "Tom", "Dick", "Harry" };
IEnumerable<string> filteredNames = names.Where(n => n.Length >= 4);
foreach (string name in filteredNames) Console.Write(name + "|");
}
}
Related examples in the same category