using System;
using ;
public partial class List :
{
protected void Page_Load(object sender, EventArgs e)
{
CreateList();
}
private void CreateList()
{
List<string> list = new List<string>();
("Compsognathus");
("Amargasaurus");
("Oviraptor");
("Velociraptor");
("Deinonychus");
("Dilophosaurus");
("Gallimimus");
("Triceratops");
//Cyclic output of each item
("Export each item separately:");
foreach (string str in list)
{
(str + ";");
}
//Looking out characters containing saurus in the string, using anonymous method (the first method)
List<string> listFind = (delegate(string s){
return ("saurus");
});
("The string found is:");
foreach (string str in listFind)
{
(str+" ;");
}
//The second method, these two methods are actually equivalent
("</br>FindAll(EndWithSaurus):");
List<string> subList = (EndWithSaurus);//A method name was passed
foreach (string str in subList)
{
(str+" ;");
}
}
private bool EndWithSaurus(string s)
{
if (( > 5) && (( - 6).ToLower() == "saurus"))
return true;
else
return false;
}
}