문제
숫자 (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);
}
나는 더 나은 방법이 있어야한다고 확신하지만, 나는 그 주위에 머리를 감싸지 못한다.
해결책
var results = from a in myEntities.thing1 where MyList.Contains(a) select a;
제휴하지 않습니다 StackOverflow