我有以下几个类:
public class Owner
{
public string Id { get; set; }
public string Name { get; set; }
}
public class Main
{
public string Id { get; set; }
public string Name { get; set; }
public List<Owner> Owners { get; set; }
}
我想将 List<Main>
转换成 List<FlatList>
,其中 FlatList 是
public class FlatList
{
public string Id { get; set; } // Id from Main
public string Name { get; set; } // Name from Main
public string OwnerId { get; set; } // Id from each Owner in a Main's Owner
public string OwnerName { get; set; } // Name from each Owner in a Main's Owner
}
很遗憾,我还没有能够找到执行此操作的LinQ查询。