質問

私はそれで数字(5,9,3)とのリストを持っています。のは、それを呼ぶことにしましょうマイリスト

私が実行したいと思います。

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);
}

私はより良い方法がなければならないと確信しているが、私はかなりそれのまわりで私の頭をラップすることはできません。

役に立ちましたか?

解決

var results = from a in myEntities.thing1 where MyList.Contains(a) select a;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top