Filter list contents with predicate (Lambda)

88

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));

Comments

Submit
0 Comments