このLINQクエリ(.NET 4.0上)があるとします。
IEnumerable<Service> listService = (from MyObject myObj in new MyObjects()
select myObj.Services);
ご覧のとおり、listService
は「コレクション」Services
のコレクションです(「サービス」のコレクションであり、タイトル、ID(必要なもの)、およびその他のフィールドが含まれています)。
LINQで実行したいのは、そのクエリを使用して、それぞれIEnumerable<int>
のIDの個別リストを使用することです。Service
Services
LINQでこれを行う方法はありますか、それともいくつかのforeachで循環し、別のアレイで管理する必要がありますか?
例 :
my first myObj (so, MyObjects[0]) have got a collection, called Service, which contain single Service. Every Service have got a single id, respectively : "1", "2", "4"
my second myObj (so, MyObjects[1]) have got a collection, called Service, which contain single Service. Every Service have got a single id, respectively : "4", "5", "1", "2"}
必要なのは、各myObjの各サービスコレクションのIDのリストを含む「単一の」コレクションです。このリストは、個別の値である必要があります。