当父母是一样的时候如何分组儿童

时间:2018-05-25 10:20:24

标签: c# asp.net algorithm entity-framework linq

我有一个列表Business看起来这个(Company:list parent; Item:list children)

Business
--------
CompanyA
    TaxRate
    Item1
        Name
        Price
        Total
    Item2
        Name
        Price
        Total
    Month
CompanyB
    TaxRate
    Item3
        Name
        Price
        Total
    Item4
        Name
        Price
        Total
    Month
CompanyA
    TaxRate
    Item5
        Name
        Price
        Total
    Item6
        Name
        Price
        Total
    Month

我想将Company分组为TaxRate,看起来就是这个

Business
--------
CompanyA
    TaxRate
    Item1
        Name
        Price
        Total
    Item2
        Name
        Price
        Total
    Item5
        Name
        Price
        Total
    Item6
        Name
        Price
        Total
    Month
CompanyB
    TaxRate
    Item3
        Name
        Price
        Total
    Item4
        Name
        Price
        Total
    Month   

我希望在这种情况下有人会帮助我

1 个答案:

答案 0 :(得分:1)

这是我找到完成任务的最佳方式:

let symbol = checker.getSymbolAtLocation(imp.name)
// Get Type 
let type = checker.getDeclaredTypeOfSymbol(symbol);