Beispiel #1
0
 /// <summary>
 /// Define a method that matches the delegate as a parameter to the FindAll method
 /// Whether the surname of the judgment object is "Li"
 /// </summary>
 /// <param name="stu">Accept the incoming Student6335 object</param>
 /// <returns>Return bool value</returns>
 public static bool FindByName6335(Student6335 stu)
 {
     return(stu.Name.StartsWith("李"));
 }
Beispiel #2
0
 /// <summary>
 /// Define the SortByName method that is compatible with delegate Comparison<T>
 /// Implement sort by name
 /// </summary>
 /// <param name="x">Accept the incoming Student6335 object</param>
 /// <param name="y">Accept the incoming Student6335 object</param>
 /// <returns>返回比较结果</returns>
 public static int SortByName(Student6335 x, Student6335 y)
 {
     return(string.Compare(x.Name, y.Name));
 }