o****e 发帖数: 916 | 1 假设有一个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! | B*****g 发帖数: 34098 | 2 linq到dotnet版问。
【在 o****e 的大作中提到】 : 假设有一个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!
|
|