I have few list List<Parent>
where Parent
class is
public class Parent
{
public string RegionName { get; set; }
public List<PhysicalRule> PhysicalRules { get; set; }
}
public class PhysicalRule
{
public string Region { get; set; }
public string LayerGroup { get; set; }
public string NetClassGroup { get; set; }
public List<RuleProperty> Properties { get; set; }
public string RuleName { get; set; }
}
public class RuleProperty
{
public string Name { get; set; }
public object Value { get; set; }
}
I want to group the List<Parent>
as
{
NetClassGroup1
[
{
Region: region1
List<PhysicalRules>
},
{
Region: region2
List<PhysicalRules>
},
{
Region: region3
List<PhysicalRules>
}
]
NetClassGroup2
[
{
Region: region1
List<PhysicalRules>
},
{
Region: region2
List<PhysicalRules>
},
{
Region: region3
List<PhysicalRules>
}
]
}
The order of Region objects should be the same in all the NetclassGroup Objects. I am planning to sort by Region name...but not sure how to construct this structure form the data objects that I have.