コード例 #1
0
 private static IEnumerable<CategoryDto> GetChildren(string parentId, CategoryDataRow[] categoryRows)
 {
     return categoryRows
         .Where(c => c.ParentId == parentId)
         .Select(c => new CategoryDto(c.Id, c.Title, GetChildren(c.Id, categoryRows).ToArray()));
 }
コード例 #2
0
 private static CategoryDto BuildHierarchy(CategoryDataRow[] categoryRows)
 {
     return new CategoryDto(null, null, GetChildren(null, categoryRows).ToArray());
 }