Answers for "Filter list contents with predicate (Lambda)"

C#
0

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));
Posted by: Guest on October-13-2021

C# Answers by Framework

Browse Popular Code Answers by Language