问一个linq to sql编程问题 (转载)# DotNet - 窗口里的风景
o*e
1 楼
【 以下文字转载自 Database 讨论区 】
发信人: okeoke (let's okeoke @ okeoke.net), 信区: Database
标 题: 问一个linq to sql编程问题
发信站: BBS 未名空间站 (Wed Jun 29 03:07:54 2011, 美东)
假设有一个table User,primary key is ID(int), one field called Name
given a list of user ID, say HashSet ids
what's the most efficient way to get the list of user?
from u in Users
where ids.Contains(u.ID)
select u
this is the most basic way i can think of. I'm sure there is a better way.
I'm using linq to sql
many thanks!
发信人: okeoke (let's okeoke @ okeoke.net), 信区: Database
标 题: 问一个linq to sql编程问题
发信站: BBS 未名空间站 (Wed Jun 29 03:07:54 2011, 美东)
假设有一个table User,primary key is ID(int), one field called Name
given a list of user ID, say HashSet ids
what's the most efficient way to get the list of user?
from u in Users
where ids.Contains(u.ID)
select u
this is the most basic way i can think of. I'm sure there is a better way.
I'm using linq to sql
many thanks!