Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Filter list contents with predicate (anonymous method)

using System;
using System.Collections.Generic;

var data = new List<int> { 1, -2, 3, 0, 2, -1 };

Predicate<int> isPositive = delegate(int val) { return val > 0; };
var filtered = data.FindAll(isPositive);

Console.WriteLine(string.Join(",", filtered));
Source by zetcode.com #
 
PREVIOUS NEXT
Tagged: #Filter #list #contents #predicate
ADD COMMENT
Topic
Name
5+3 =