using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
static void Main() {
Func<string, bool> Has4Letters = str => str.Length == 4;
string[] words =
{
"play", "sing", "sci", "fi", "game", "pro", "dev" , "five",
"moon", "c#", "net", "cool", "programming"
};
IEnumerable<string> FourLetterWords = words.Where(Has4Letters);
foreach (var word in FourLetterWords) {
Console.WriteLine(word);
}
}
}
/*
run:
play
sing
game
five
moon
cool
*/