Filter list contents with predicate (Lambda)

Code Example - Filter list contents with predicate (Lambda)

                
                        using System;
using System.Collections.Generic;

var words = new List<string> { "falcon", "wood", "tree",
    "rock", "cloud", "rain" };

Predicate<string> hasFourChars = word => word.Length == 4;

var words2 = words.FindAll(hasFourChars);
Console.WriteLine(string.Join(',', words2));