C# Predicates
Friday, June 29th, 2007I know this is really simple stuff but it is my first venture into predicates. This is really coo!
using System;
using System.Collections.Generic;
using System.Text;
namespace Predicate
{
class Program
{
static void Main(string[] args)
{
List<string> stringList = new List<string>();
stringList.Add(”Jamie”);
stringList.Add(”Thom”);
stringList.Add(”Monkey”);
stringList.Add(”Badger”);
stringList.Find(HasAnE);
stringList.FindAll(HasAnE).ForEach(Console.WriteLine);
Console.WriteLine(stringList.Find(HasAnE));
Console.ReadLine();
}
public static bool HasAnE(string val)
{
return val.IndexOf(’e') > -1;
}
}
}