using System.Collections.Generic;
public IDMacroTab IDMacroTab { get; set; }
public List<Tab> Tabs { get; set; }
public static implicit operator IDMacroTab(int a)
return new IDMacroTab { Value = a };
public static implicit operator IDTab(int a)
return new IDTab { Value = a };
public static implicit operator IDSlot(int a)
return new IDSlot { Value = a };
Slots = new List<Slot>();
public IDTab IDTab { get; set; }
public List<Slot> Slots { get; set; }
public IDSlot IDSlot { get; set; }
public static void Main()
List<MacroTab> hierarchaldata = CreateHierarchaldata();
var flattenedList = (from macroTab in hierarchaldata
from tab in macroTab.Tabs
select new {macroTab.IDMacroTab, tab.IDTab, slot.IDSlot}).ToList();
var macroTabs = flattenedList
.GroupBy(x => x.IDMacroTab)
.Select((x) => new MacroTab
Tabs = x.GroupBy(t => t.IDTab)
Slots = tx.Select(s => new Slot
var antiflatten = from x in flattenedList
IDMacroTab = grouping_0.Key,
Tabs = (from t in grouping_0
Slots = (from t1 in grouping_1
var antiflatten2 = from x in flattenedList
select new {IdMacrotab = grouping_0.Key, Data = new {IDTab = y.IDTab, IDSlot = y.IDSlot}};
private static List<MacroTab> CreateHierarchaldata()
List<MacroTab> p = new List<MacroTab>