I have this object structure:
public class Root
{
public int Value1;
public int Value2;
public List<NestedA> NestedAList;
}
public class NestedA
{
public List<NestedB> NestedBList;
public List<NestedC> NestedCList;
}
public class NestedB{
public int ValueB;
public int ValueB2;
}
public class NestedC{
public int ValueC;
public int ValueC2;
}
I need to group root objects using all Values from Root class and it's nested lists. I've been playing around a while and can't figure out how to/or if I can do this in a single group by statement, or what the best approach to acomplish this could be.
Edit: I need the items grouped by Root properties, Nested A Properties, Nested B Properties and Nested C Properties. So it makes sense: My real objects have more properties, just showing the ones that I need grouped, and can use as a start point.
Thanks in advance.
If we have this element
Root
Value1 = 1
Value2 = 2
NestedAList = [
{NestedBList = [
{ValueB=2, ValueB2=3}
]
NestedCList = [
{ValueC=5, ValueC2=11}
]}
]
it should be grouped with this one:
Root
Value1 = 1
Value2 = 2
NestedAList = [
{NestedBList = [
{ValueB=2, ValueB2=3}
]
NestedCList = [
{ValueC=5, ValueC2=11}
]}
]
but not with this one:
Root
Value1 = 1
Value2 = 2
NestedAList = [
{NestedBList = [
{ValueB=2, ValueB2=3}, { ValueB= 1, ValueB2=4}
]
NestedCList = [
{ValueC=5, ValueC2=11}
]}
]