예제 #1
0
 public T Find(CompareFunc_2 match, object obj)
 {
     for (int i = 0; i < size; i++)
     {
         if (match(buffer[i], obj))
         {
             return(buffer[i]);
         }
     }
     return(default(T));
 }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="match"></param>
 /// <param name="obj">值类型装换成object有装箱操作,有一定的性能消耗,防止大量的装箱的出现</param>
 /// <param name="list"></param>
 public void FindAll(CompareFunc_2 match, object obj, CSBetterList <T> list)
 {
     list.Clear();
     for (int i = 0; i < size; i++)
     {
         if (match(buffer[i], obj))
         {
             list.Add(buffer[i]);
         }
     }
 }