I have these two clases:
public class Client{
public List<Address> addressList{get;set;}
}
public class Address{
public string name { get; set; }
}
and I have a List of type Client
called testList
. It contains n clients and each one of those contains n addresses
List<Client> testList;
how can i do the following using LINQ:
foreach (var element in testList)
{
foreach (var add in element.addressList)
{
console.writeLine(add.name);
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…