using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
public class MainClass
{
public delegate Boolean CheckString(String Str);
public static void Main(string[] args)
{
String[] TestArray = { "One", "Two", "Three", "Four", "Five" };
String[] OutputArray = FilterStrings(TestArray, TestStr => TestStr.Length > 3);
foreach (String ThisString in OutputArray)
Console.WriteLine(ThisString);
}
public static String[] FilterStrings(String[] Input, CheckString Filter)
{
ArrayList ResultList = new ArrayList();
foreach (String ThisString in Input)
{
if (Filter(ThisString))
ResultList.Add(ThisString);
}
return (String[])ResultList.ToArray(typeof(String));
}
}
|