I have a generic list - SupportedTypeGroups.
Each SupportedTypeGroup has SupportedTypes property (generic list of SupportedType).
How to construct a Linq query to locate SupportedType with required name?
var result = SupportedTypeGroups
.SelectMany(g => g.SupportedTypes)
.FirstOrDefault(t => t.Name == "TypeName");
SupportedTypeGroups
.SelectMany(s => s.SupportedTypes)
.Where(s => s.name == "TheName");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With