Hiển thị các bài đăng có nhãn linq. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn linq. Hiển thị tất cả bài đăng

Thứ Sáu, 11 tháng 1, 2013

LINQ ~ where like


x = (from r in ctx.xxxxxx
where r.name.Contains("adasdad")
select (new KeyValuePair(r.id.ToString(), r.name))
).ToDictionary(t => t.Key, t => t.Value);


reference
http://stackoverflow.com/questions/5374481/like-operator-in-linq

Thứ Sáu, 9 tháng 11, 2012

LINQ ~ where clause example

dynamic labor = ctx.Qoo.Where(l => l.xxxID== xxxID).Select(l => l).ToList().Select(l =>
{
dynamic aaa = new ExpandoObject();
aaa.ooo= l.ooo;
aaa.yyy= l.yyy;
aaa.hhh= l.hhh;
return aaa;
}).ToArray();

reference
http://stackoverflow.com/questions/8663897/why-is-linq-wherepredicate-first-faster-than-firstpredicate