匿名方法
核心就是lambda语法,下面是使用举例:
var conn= MySqlHelper.GetConn();
var list=conn.Query<User>("SELECT Account FROM `QQ_User` ").ToArray();
list.OrderBy(p => p.Account);
list.OrderByDescending(p => p.Account);
list.Where(p => p.Account == "10001");-----返回的是数组,及时没有找到符合条件的p,也是返回的空数组。可以用.count来判断是否取到了需要的值
list.FirstOrDefault(p => p.Account == "10001");
list.Select(p => p.Account);
//public static IEnumerable<TResult> Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector);
var temp = list.Select(p => new Temp() { QQNumber = p.Account });
list.Count(p => p.Account == "10001");
list.Where(p => p.Age > 20).OrderBy(p => p.Age).Skip(49).Take(50);
list.all
list.any