我正在尝试将该模型展平为收藏。
public class Category
{
public string name;
public string id;
public Subcategory subcategory;
}
public class Subcategory
{
public string name;
public string id;
public List<Product> products;
}
public class Product
{
public string name;
public string id;
public Supplier1 supplier1;
public Supplier2 supplier2
}
public class Supplier1
{
public string name;
public string id;
}
public class Supplier2
{
public string name;
public string id;
}
我需要使用 LINQ 将它们转换为以下类型的对象集合:
public class MixedClass
{
public string CategoryId;
public string SubcategoryId;
public string ProductId ;
public string Supplier1Id ;
public string Supplier2Id ;
}
我已经尝试过 selectman,但我还不够深入。