1. 程式人生 > >委托的匿名方法

委托的匿名方法

ret nbsp code 委托 def dal void clas string

 1     class Program
 2     {
 3         static void Main(string[] args)
 4         {
 5             List<string> list = new List<string>() { "abf", "cde", "def" };
 6             List<string> resultList = list.FindAll(
 7                     delegate(string s)
 8                     {
9 return s.IndexOf(f) >= 0; 10 } 11 ); 12 string[] resulStrings = resultList.ToArray(); 13 foreach (var s in resulStrings) 14 { 15 Console.WriteLine(s); 16 } 17 18 } 19
20 }

委托的匿名方法