Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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));
Source by zetcode.com #
 
PREVIOUS NEXT
Tagged: #Filter #list #contents #predicate
ADD COMMENT
Topic
Name
4+6 =