var user = Global.userIpList.FirstOrDefault(u => u.UserId == CookieInfo.UserId.ToInt());
括号里的 u => u.UserId == CookieInfo.UserId.ToInt()
解决方案
5
lambda表达式,匿名方法。
可用下边代码替换
可用下边代码替换
private bool Method(User u) { return .UserId == CookieInfo.UserId.ToInt(); } ... var user = Global.userIpList.FirstOrDefault(Method);
15
var user = Global.userIpList.FirstOrDefault(u => u.UserId == CookieInfo.UserId.ToInt());
等于
select * from userIpList where UserID=CookieInfo.UserId
这是lambda,匿名表达式