5
Top Tier Object
SubTier Objects
SubSubTier Objects 1.1,1.2,1.3 : SubTierId = 2
SubSubTier Objects 2.1,2.2,1.3 : SubTierId = 3
SubTier Objects
SubSubTier Objects 3.1,3.2,3.3 : SubTierId = 1
SubSubTier Objects 4.1,4.2,4.3 : SubTierId = 2
I risultati finali attesi sono ottenere un oggetto IEnumerable con 1.2, 2.3, 3.1, 4.2 che rappresenta il SubTierId di ciascun sottotitolo.Come ottenere oggetti secondari in base al valore usando linq?
SubSubTiers mySubSubTier = allTiers.Select(topTier =>
topTier.SubTiers.Where(sbTier => sbTier.Id == topTier.SubTierId));
ma quello che succede è che ottengo questo tipo di ritorno.
IEnumerable<IEnumerable<SubSubTier>>
Qual è il modo migliore in modo che ottengo solo un singolo IEnumerable
del SubSubTier
?
è possibile utilizzare SelectMany al posto di Select – wudzik
erano la mia risposta è stata utile? Avete altri problemi? – wudzik
Sì, il trucco non è tornato subito. Grazie mille! :) – MichaelChan