0

我有一个包含数字 (5,9,3) 的列表。让我们称之为 MyList

我想表演

var results = from a in myEntities.thing1 where a.ID belongsto MyList select a;

现在我做

List<T> t = new List<T>(); //I actually define T to a strong type

foreach (int i in MyList)
{
t.add(from a in myEntities.thing1 where a.ID==i select a);
}

我确信一定有更好的方法,但我无法完全理解它。

4

1 回答 1

6
var results = from a in myEntities.thing1 where MyList.Contains(a) select a;
于 2009-11-18T01:49:22.757 回答