using System;
public class Example
{
public static void Main()
{
string[] letters = { "E","B", "A", "Z", "D","X", "Y", "Q" };
Console.WriteLine();
foreach(string letter in letters)
{
Console.WriteLine(letter);
}
Console.WriteLine("\nArray.Find(letters, EndsWithS): {0}", Array.Find(letters, EndsWithS));
}
private static bool EndsWithS(String s)
{
if ((s.Length > 5) &&
(s.Substring(s.Length - 6).ToLower() == "s"))
{
return true;
}
else
{
return false;
}
}
}
|